如何解决iPhone sdk中错误处理方法中的问题
| 我在appDelegate方法中全局使用错误处理方法来捕获异常。 码: //在appDelegate.m中 static void uncaughtExceptionHandler(NSException *exception)
{
printf(\"\\n ===== In uncaughtExceptionHandler Method =======\");
NSArray *stack = [exception callStackReturnAddresses];
NSLog(@\"======== Exception *************%@\",stack);
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@\"\" message:@\"Exception Occured\"
delegate:self cancelButtonTitle:@\"OK\" otherButtonTitles: nil];
[alert show];
[alert release];
}
-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary
*)launchOptions
{
// Override point for customization after application launch.
NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);
}
我正在uncaughtExceptionHandler方法中实现一个Alert。但是我得到错误
\“自我\”未声明。
任何人都可以建议uncaughtExceptionHandler是时如何实现Alert
叫。
提前致谢。
解决方法
尝试实现此处理未捕获的异常
, a2ѭ函数中未定义1ѭ。如果要使应用程序委托警报视图的委托,则您可能应将
self
替换为[[UIApplication sharedApplication] delegate]
。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。