【问题标题】:iPhone app crashes randomly on device while connecting to remote server?iPhone应用程序在连接到远程服务器时在设备上随机崩溃?
【发布时间】:2012-07-24 10:28:22
【问题描述】:

我有一个应用程序,它使用 web 服务发布和获取数据,它工作正常,但是在严格测试应用程序时,应用程序严重崩溃,消息 Application Exited exceptionly with signal 9(Killed)

Mon Jul 16 21:07:55 unknown MyApp[167] <Warning>: NVVC Dealloc 
        Mon Jul 16 21:08:23 unknown com.apple.launchd[1] <Notice>: (UIKitApplication:com.company.MyApp[0xe271]) Bug: launchd_core_logic.c:2688 (24132):10 
        Mon Jul 16 21:08:23 unknown com.apple.launchd[1] <Notice>: (UIKitApplication:com.company.MyApp[0xe271]) Working around 5020256. Assuming the job crashed. 
        Mon Jul 16 21:08:23 unknown com.apple.launchd[1] <Warning>: (UIKitApplication:com.company.MyApp[0xe271]) Job appears to have crashed: Segmentation 
        fault 
        Mon Jul 16 21:08:23 unknown SpringBoard[29] <Warning>: Application 'MyApp' exited abnormally with signal 11: Segmentation fault 
        Mon Jul 16 21:09:04 unknown lockdownd[20] <Error>: (0x403000) handle_connection: Could not receive USB message #7 from Xcode. Killing connection 
        Mon Jul 16 22:00:39 unknown com.apple.launchd[1] <Notice>: (UIKitApplication:com.apple.mobilemail[0x55fb]) Exited: Killed 
        Mon Jul 16 22:00:39 unknown com.apple.launchd[1] <Notice>: (UIKitApplication:com.apple.mobilephone[0xa13c]) Exited: Killed 
        Mon Jul 16 22:00:39 unknown com.apple.launchd[1] <Notice>: (UIKitApplication:com.MyApp.app[0x137]) Exited: Killed 
        Mon Jul 16 22:00:39 unknown com.apple.launchd[1] <Notice>: (com.apple.accessoryd) Exited: Killed 
        Mon Jul 16 22:00:41 unknown SpringBoard[29] <Warning>: Application 'Mail' exited abnormally with signal 9: Killed 
        Mon Jul 16 22:00:41 unknown SpringBoard[29] <Warning>: Memory level is not normal (15%). Delaying auto-relaunch of 'Mail' for 30 seconds. Mon Jul 16 22:00:41 unknown SpringBoard[29] <Warning>: Application 'app' exited abnormally with signal 9: Killed 
        Mon Jul 16 22:00:42 unknown SpringBoard[29] <Warning>: Application 'Phone' exited abnormally with signal 9: Killed 

我四处搜索,但找不到任何解决方案或杀死应用程序的原因。请帮助我解决问题。

编辑#2 在这里,我添加了一些我的应用程序崩溃的代码。

 @try {

    [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;

    NSUserDefaults *defaults2 = [NSUserDefaults standardUserDefaults];

    NSString *string = [NSString stringWithFormat:URL];

                NSURL *url = [NSURL URLWithString:string];
            NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL: url];
                // NSURLRequest *request =[NSURLRequest requestWithURL:[NSURL URLWithString:synStr]];
            NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
            [connection start];
            [connection release];
            if(label != nil){
       progressView = [[ProgressView showHUDAddedTo:self.tabBarController.view animated:YES]retain];
       progressView.labelText = label;
        }

       [request release];
           }
    @catch (NSException * e) {   
    }

【问题讨论】:

  • 不看你的代码就很难说。
  • 你为什么要两次发布这个问题,还有很多其他人发布了相同的崩溃日志。从那些旧的问题答案和提示开始,看看您是否可以更好地识别问题。
  • 亲爱的 janusfidel,请在此处查看我对代码的第二次编辑,这是我怀疑会崩溃的代码。

标签: iphone ipad crash


【解决方案1】:

您错误地使用了NSURLConnection。如果您查看here,您可以看到您正在启动一个异步连接。看起来您在连接对象完成之前释放了它,这导致了分段错误。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-17
    • 2018-11-17
    相关资源
    最近更新 更多