gpt4 book ai didi

ios - NSException 派生类或异常名称列表?

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:45:58 24 4
gpt4 key购买 nike

我已经通过了 Introduction to Exception Programming Topics for Cocoa .在 Throwing Exceptions 下, 显示了一个异常名称:FileNotFoundException:

NSException *e = [NSException
exceptionWithName:@"FileNotFoundException"
reason:@"File Not Found on System"
userInfo:nil];

@throw e;

然而,Predefined Exceptions页面列出了大约 10 个异常,FileNotFoundException 未列出。

在哪里可以找到常见或预期异常和名称的列表?

最佳答案

这很奇怪,这些是我看到的在 NSExcpetion.h 中定义的唯一常量:

FOUNDATION_EXPORT NSString * const NSGenericException;
FOUNDATION_EXPORT NSString * const NSRangeException;
FOUNDATION_EXPORT NSString * const NSInvalidArgumentException;
FOUNDATION_EXPORT NSString * const NSInternalInconsistencyException;

FOUNDATION_EXPORT NSString * const NSMallocException;

FOUNDATION_EXPORT NSString * const NSObjectInaccessibleException;
FOUNDATION_EXPORT NSString * const NSObjectNotAvailableException;
FOUNDATION_EXPORT NSString * const NSDestinationInvalidException;

FOUNDATION_EXPORT NSString * const NSPortTimeoutException;
FOUNDATION_EXPORT NSString * const NSInvalidSendPortException;
FOUNDATION_EXPORT NSString * const NSInvalidReceivePortException;
FOUNDATION_EXPORT NSString * const NSPortSendException;
FOUNDATION_EXPORT NSString * const NSPortReceiveException;

FOUNDATION_EXPORT NSString * const NSOldStyleException;

关于ios - NSException 派生类或异常名称列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18564364/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com