开发者

How to diagnose a SIGKILL error for the iPhone?

Hey all basically I'm trying to save an array of custom objects, it saves fine but when I close the app and reopen it actually loads the saved array (into a table view) but freezes up and all I get is SIGKILL. How do I find what's causing the issue?

This is the code I'm using to load the data if it helps:

NSFileManager *fi开发者_StackOverflow中文版leManager = [NSFileManager defaultManager];

     if([fileManager fileExistsAtPath:dataFilePath]) {
         // Load the array
         NSMutableArray *arrayFromDisk = [NSKeyedUnarchiver
                                          unarchiveObjectWithFile:dataFilePath];

         [Data sharedData].listOfItems = arrayFromDisk;

         NSLog(@"Loaded");
     }


Setting the following breakpoints might help:

  • objc_exception_throw
  • malloc_error_break
  • [NSException raise]

Check this thread for xCode 4 https://devforums.apple.com/thread/68421

on xCode 3 http://blog.emmerinc.be/index.php/2009/03/19/break-on-exception-in-xcode/

Hope this helps


It sounds like your code may be throwing an exception, which would be most likely to happen at unarchiveObjectWithFile:. The normal behavior is to log the exception and stacktrace to the console (so look there), but you could also try wrapping the call in @try ... @catch to see if in fact an exception is being thrown:

@try {
    // Load the array
    NSMutableArray *arrayFromDisk = [NSKeyedUnarchiver
                                      unarchiveObjectWithFile:dataFilePath];

    [Data sharedData].listOfItems = arrayFromDisk;

    NSLog(@"Loaded");       
}

@catch (NSException* e) {
    NSLog(@"Caught exception: %@", e);
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜