Ohoh your iphone app just crashed! One way to debug the crash is by inspecting the crash log. Here's how..
1. Before releasing the application for iphone you must first build your app for Archiving on xcode.
This will generate both the ProjectName.app and ProjectName.app.dSYM files. You will see the generated ProjectName.app file in the target section of the project in xcode. Selecting the 'Show in Finder' option(right click target ProjectName.app file) will reveal the location of both these required files. Copy these files to a new folder named Project_CrashDebugging.
2. Sync your iphone using itunes. Now your applications crash logs will have been copied to the computer. Generally you can find them at the following path your_home_folder_name/Library/Logs/CrashReporter/MobileDevice/your_device_name
3. Select the crash log from your project and copy it to Project_CrashDebugging folder you created earlier.
4. To demystify the crash log you will need to use the symbolicatecrash application. Typically it will be located at the following path /Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/. If not find it in your hard drive by searching for it using the locate function in console. Once you have found it copy it to one of your computers Path location (check you path locations using echo $PATH in console), generally copying /usr/bin will do. Now you can call symbolicatecrash directly from the console.
5. cd to your Project_CrashDebugging folder and now call..
symbolicatecrash crash_log_name ProjectName.app.dSYM > filename.crash
now you will have created a symbolicated filename.crash file which you can refer for debugging
Given below are parts of an example application I use to try out symbolicatecrash.
from ExampleViewController.m
- (void)viewDidLoad
{
NSString *test = [[[NSString alloc] initWithFormat:@"Test"] autorelease];
[test release];
NSLog(@"Test is: %@", test);//calling test after release will result in a crash
[super viewDidLoad];
}
from initial crash log..
Date/Time: 2011-08-10 11:09:33.253 +0530
OS Version: iPhone OS 5.0 (9A5288d)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x576e6f69
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x36c85fc2 0x36c82000 + 16322
1 Foundation 0x35238bb8 0x3522f000 + 39864
2 CoreFoundation 0x354e3d06 0x35454000 + 589062
3 CoreFoundation 0x35477d24 0x35454000 + 146724
4 CoreFoundation 0x354984b0 0x35454000 + 279728
5 Foundation 0x3524c914 0x3522f000 + 121108
6 Foundation 0x3524c8b4 0x3522f000 + 121012
7 Example 0x000027a4 0x1000 + 6052
8 UIKit 0x34a3c124 0x349ff000 + 250148
9 UIKit 0x34a1777a 0x349ff000 + 100218
10 UIKit 0x34b6d288 0x349ff000 + 1499784
11 Example 0x00002538 0x1000 + 5432
12 UIKit 0x34a17f1c 0x349ff000 + 102172
13 UIKit 0x34a070e6 0x349ff000 + 32998
14 UIKit 0x34a06032 0x349ff000 + 28722
15 UIKit 0x34a05ad0 0x349ff000 + 27344
16 UIKit 0x34a055ea 0x349ff000 + 26090
17 GraphicsServices 0x33f27ef4 0x33f23000 + 20212
18 CoreFoundation 0x354d79c4 0x35454000 + 539076
19 CoreFoundation 0x354d7966 0x35454000 + 538982
20 CoreFoundation 0x354d658c 0x35454000 + 533900
21 CoreFoundation 0x35478036 0x35454000 + 147510
22 CoreFoundation 0x35477efe 0x35454000 + 147198
23 UIKit 0x34a03758 0x349ff000 + 18264
24 UIKit 0x34a0098a 0x349ff000 + 6538
25 Example 0x000024ba 0x1000 + 5306
26 Example 0x00002478 0x1000 + 5240
from symbolicated crash log..
Date/Time: 2011-08-10 11:09:33.253 +0530
OS Version: iPhone OS 5.0 (9A5288d)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x576e6f69
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x36c85fc2 0x36c82000 + 16322
1 Foundation 0x35238bb8 0x3522f000 + 39864
2 CoreFoundation 0x354e3d06 0x35454000 + 589062
3 CoreFoundation 0x35477d24 0x35454000 + 146724
4 CoreFoundation 0x354984b0 0x35454000 + 279728
5 Foundation 0x3524c914 0x3522f000 + 121108
6 Foundation 0x3524c8b4 0x3522f000 + 121012
7 Example 0x000027a4 -[ExampleViewController viewDidLoad] (ExampleViewController.m:35)
8 UIKit 0x34a3c124 0x349ff000 + 250148
9 UIKit 0x34a1777a 0x349ff000 + 100218
10 UIKit 0x34b6d288 0x349ff000 + 1499784
11 Example 0x00002538 -[ExampleAppDelegate application:didFinishLaunchingWithOptions:] (ExampleAppDelegate.m:24)
12 UIKit 0x34a17f1c 0x349ff000 + 102172
13 UIKit 0x34a070e6 0x349ff000 + 32998
14 UIKit 0x34a06032 0x349ff000 + 28722
15 UIKit 0x34a05ad0 0x349ff000 + 27344
16 UIKit 0x34a055ea 0x349ff000 + 26090
17 GraphicsServices 0x33f27ef4 0x33f23000 + 20212
18 CoreFoundation 0x354d79c4 0x35454000 + 539076
19 CoreFoundation 0x354d7966 0x35454000 + 538982
20 CoreFoundation 0x354d658c 0x35454000 + 533900
21 CoreFoundation 0x35478036 0x35454000 + 147510
22 CoreFoundation 0x35477efe 0x35454000 + 147198
23 UIKit 0x34a03758 0x349ff000 + 18264
24 UIKit 0x34a0098a 0x349ff000 + 6538
25 Example 0x000024ba main (main.m:14)
26 Example 0x00002478 start + 32
This comment has been removed by the author.
ReplyDelete