I know i can throw an NSException in my own code,does iphone os framework throw NSException itself? if it does,means that i should catch the NSExceptions from framework? I know Java throws Exceptions inner SDK,such as unchecked exceptions.
You want to throw NSExceptions in your code, and you want to know if the framework throws them too. Well, it throws them if an error occurs. You can catch them by putting each exception-throwing piece of code in a try... catch... finally block which is different from the one for "your" exception-throwing code :) Maybe others can offer more info and hope I got it right what you are trying to do.
Exceptions thrown by the frameworks in iOS and Cocoa are indicative of unrecoverable errors. Exceptions are not used (outside of very extreme exceptions) to convey something like a validation problem.
In general, iOS and Cocoa use NSError
to convey recoverable problems (like user entry validation errors, state validation errors in Core Data, or connectivity issues, for examples).
You should not use exceptions within your own code for purposes beyond indicating unrecoverable problems. It goes against the patterns of the underlying frameworks and doing so will make your code more difficult to evolve over time.