Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iPhone sdk中的错误处理方法存在问题_Iphone_Objective C_Exception Handling - Fatal编程技术网

iPhone sdk中的错误处理方法存在问题

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

我在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方法中实现一个警报。但我也有错误 自我未申报

有人能建议如何在未捕获ExceptionHandler时实现警报吗 打电话来


提前感谢。

尝试实现此功能。

C函数中未定义self。如果要将应用程序委派为警报视图的委派,则可能应将self替换为[[UIApplication sharedApplication]delegate]。

@Lakshmi有帮助吗?你需要进一步的帮助吗?