objc- exception

 void objc_exception_throw(id exception);
 void objc_exception_try_enter(void *localExceptionData);
 void objc_exception_try_exit(void *localExceptionData);
 id objc_exception_extract(void *localExceptionData);
 int objc_exception_match(Class exceptionClass, id exception);

typedef struct {
    int version;
    void (*throw_exc)(id);      // version 0
    void (*try_enter)(void *);  // version 0
    void (*try_exit)(void *);   // version 0
    id   (*extract)(void *);    // version 0
    int (*match)(Class, id);    // version 0
} objc_exception_functions_t;

 void objc_exception_get_functions(objc_exception_functions_t *table);

 void objc_exception_set_functions(objc_exception_functions_t *table);

typedef id (*objc_exception_preprocessor)(id exception);
typedef int (*objc_exception_matcher)(Class catch_type, id exception);
typedef void (*objc_uncaught_exception_handler)(id exception);
typedef void (*objc_exception_handler)(id unused, void *context);

OBJC_EXPORT void objc_exception_throw(id exception)
    OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0);
OBJC_EXPORT void objc_exception_rethrow(void)
    OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0);
OBJC_EXPORT id objc_begin_catch(void *exc_buf)
    OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0);
OBJC_EXPORT void objc_end_catch(void)
    OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0);
OBJC_EXPORT void objc_terminate(void)
    OBJC_AVAILABLE(10.8, 6.0, 9.0, 1.0);


OBJC_EXPORT objc_exception_preprocessor objc_setExceptionPreprocessor(objc_exception_preprocessor fn)
    OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0);
OBJC_EXPORT objc_exception_matcher objc_setExceptionMatcher(objc_exception_matcher fn)
    OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0);
OBJC_EXPORT objc_uncaught_exception_handler objc_setUncaughtExceptionHandler(objc_uncaught_exception_handler fn)
    OBJC_AVAILABLE(10.5, 2.0, 9.0, 1.0);

// Not for iOS.
OBJC_EXPORT uintptr_t objc_addExceptionHandler(objc_exception_handler fn, void *context)
    __OSX_AVAILABLE(10.5) 
    __IOS_UNAVAILABLE __TVOS_UNAVAILABLE __WATCHOS_UNAVAILABLE;
OBJC_EXPORT void objc_removeExceptionHandler(uintptr_t token)
    __OSX_AVAILABLE(10.5) 
    __IOS_UNAVAILABLE __TVOS_UNAVAILABLE __WATCHOS_UNAVAILABLE;

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容