iPhone sdk中的错误处理方法存在问题
我在appDelegate方法中全局使用错误处理方法捕获异常 代码: //在appDelegate.m中iPhone sdk中的错误处理方法存在问题,iphone,objective-c,exception-handling,Iphone,Objective C,Exception Handling,我在appDelegate方法中全局使用错误处理方法捕获异常 代码: //在appDelegate.m中 static void uncaughtExceptionHandler(NSException *exception) { printf("\n ===== In uncaughtExceptionHandler Method ======="); NSArray *stack = [exception callStackReturnAddresses]; NSLo
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方法中实现一个警报。但我也有错误
自我未申报
有人能建议如何在未捕获ExceptionHandler时实现警报吗
打电话来
提前感谢。尝试实现此功能。C函数中未定义self。如果要将应用程序委派为警报视图的委派,则可能应将self替换为[[UIApplication sharedApplication]delegate]。@Lakshmi有帮助吗?你需要进一步的帮助吗?