Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Exceptions on iOS3.2 and higher not being caught?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Exceptions on iOS3.2 and higher not being caught?



I realize this may be a little off topic for the list, but it's right on the fuzzy edge of the ObjC language vs the Foundation framework, and I was hoping our local runtime wrangler expert may have an idea for me:

It appears that exceptions on iOS3.2+ can't be thrown across NSInvocations. This only seemed to start happening with the iOS3.2 release.
@try {


NSInvocation invocation = [self getAninvocationThatThrowsAnException];

[invocation invokeWithTarget:self]; }

@catch (NSException e) {

 NSLog(@"%@", e);

}

Doesn't get caught, but

@try {

NSInvocation invocation = [self getAninvocationThatThrowsAnException];

objc_msgSend(self, [invocation selector]); }

@catch (NSException e) {

NSLog(@"%@", e);

}

does. This causes a lot of problems for testing frameworks (GoogleToolbox, OCMock, Hamcrest and most like SenTestingKit) on iOS as they all depend on throwing exceptions across NSInvocations to propagate error conditions.

Is this intentional, or a bug? I would think it is a bug, except I would expect that anyone using any test driven development would've run into it pretty much immediately. We had seen it internally, but I hadn't had time to look at the cause until now.

Radar 8081169 if that helps. (http://openradar.appspot.com/8081169)

Cheers,

Dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.