Sweety
Sweety

Reputation: 71

Exception Handling....in Xcode/Obj-C

Is there a feature in Xcode to do something like this:

Select a section of source code, chose a refactoring or similar type menu option and the IDE would then wrap the source code in a try/catch block with all the exceptions that could be thrown based on the Class API's used in the selected code?

As a second question, I'm more familar with OO languages where a significant portion of the code is wrapped in try/catch blocks in a production applciation. For example; if an attempt is made to access an array with an invalid index then an "ArrayOutOfBoundsException" would be thrown at runtime, and would be handled by the try/catch block surrounding the code. Is there a similar mechanism is Objective-C? Although I do see that Objective C supports try/catch blocks and expection handling with NSException, I just donot see it used much in the code of the sample projects, or in general which exceptions a given class may throw in the Class References. However I have not yet been thru to many of the class references.

Thank you...

Upvotes: 0

Views: 794

Answers (1)

user557219
user557219

Reputation:

For your first question: No. Consider filing an enhancement request with Apple.

For your second question: It has already been covered by other questions on Stack Overflow like here, here, here, or here. The search box is your friend.

Upvotes: 2

Related Questions