开发者

Fail to catch exception from proxy object under Xcode 3.2.3

I use HessianKit to communicate with server. In the situation of network or server down Hessian will throw exception, so I put every Hessian call in a @try ... @catch block. Everything worked fine until I upgraded Xcode from 3.2.2 to 3.2.3. I wrote the some testing code and found under Xcode 3.2.3, catch exception would b开发者_如何学Pythone failed if the exception was thrown from a proxy object.

MyProxy.h:

@interface MyProxy : NSProxy {
}
@end

MyProxy.m:

@implementation MyProxy

- (id)init {
    return self;
}

- (void)forwardInvocation:(NSInvocation *)invocation {
    NSLog(@"Call method %@", NSStringFromSelector([invocation selector]));
    [NSException raise:@"MyException" format:@"this is an exception"];
}

- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector {
    .....
}

@end

Code using MyProxy:

@try {
    MyProxy *p = [[MyProxy alloc] init];
    [p doSomething];
    [p release];
}
@catch (NSException * e) {
    NSLog(@"%@", e);
}

When these code build under xcode 3.2.2, the exception can be catched correctly. But under xcode 3.2.3, the program terminated after output following on the console:

2010-09-08 21:09:29.877 BriefCase[34651:40b] Call method doSomgthing
2010-09-08 21:09:29.879 BriefCase[34651:40b] *** Terminating app due to uncaught exception 'MyException', reason: 'this is an exception'
2010-09-08 21:09:29.880 BriefCase[34651:40b] Stack: (
    45955152,
    47113004,
    45692683,
    45692522,
    151932,
    45426420,
    45423090,
    9352,
    4417860,
    4421967,
    4447550,
    4429047,
    4461016,
    53399932,
    45234332,
    45230248,
    4420129,
    4453234,
    8812,
    8666
)
terminate called after throwing an instance of 'NSException'
Program received signal:  “SIGABRT”.

What can I do?


I filed a bug with Apple, and the reply is:

It has been determined that this is a known issue, which is currently being investigated by engineering. This issue has been filed in our bug database under the original Bug ID# 7995323.


Maybe your project/target/executable settings have been messed up? Is the "Enable Objective-C Exceptions" box ticked for your configuration/target/etc?

If it is, maybe you should file a bug with Apple here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜