NSException and Nserror
Many languages throw all unintended (unexpected) errors as exceptions, but objective-c exceptions are only used to handle program errors. When an exception is thrown, the details are encapsulated in the NSException object. This information is primarily used to help programmers debug code, such as "attempting to access a seventh object in an array of only two objects." The NSException also includes the method call stack information, indicating the location of the code that throws the exception.
NSException and Nserror have different usage scenarios. If you need to indicate a programmer's coding error, you should use NSException. For example, a method can only accept an odd number as an argument, but the programmer passes an even number when calling the method, and an exception should be thrown to facilitate the programmer to resolve the code error. Conversely, for expected (expected) errors, such as user errors and device environment errors, you should use Nserror. For example, a method needs to read a user's photo, but does not have access to the user's album, and should return a Nserror object to the method caller indicating why the operation could not be performed.
NSException and Nserror