My App crashes when launched on my Iphone
- by Miky Mike
hi guys,
I have a problem here : my app crashed on my Iphone (JB) though Xcode doesn't complain about anything. The app works fine on the simulator though.
However, there is this in the device logs :
Thread 0 Crashed:
0 libSystem.B.dylib 0x00078ac8 kill + 8
1 libSystem.B.dylib 0x00078ab8 kill + 4
2 libSystem.B.dylib 0x00078aaa raise + 10
3 libSystem.B.dylib 0x0008d03a abort + 50
4 libstdc++.6.dylib 0x00044a20 __gnu_cxx::__verbose_terminate_handler() + 376
5 libobjc.A.dylib 0x00005958 _objc_terminate + 104
6 libstdc++.6.dylib 0x00042df2 _cxxabiv1::_terminate(void (*)()) + 46
7 libstdc++.6.dylib 0x00042e46 std::terminate() + 10
8 libstdc++.6.dylib 0x00042f16 __cxa_throw + 78
9 libobjc.A.dylib 0x00004838 objc_exception_throw + 64
10 CoreFoundation 0x0009fd0e +[NSException raise:format:arguments:] + 62
11 CoreFoundation 0x0009fd48 +[NSException raise:format:] + 28
12 Foundation 0x000125d8 -[NSURL(NSURL) initFileURLWithPath:] + 64
13 Foundation 0x000371e0 +[NSURL(NSURL) fileURLWithPath:] + 24
14 TheLearningMachine 0x00002d08 0x1000 + 7432
15 TheLearningMachine 0x00002e8c 0x1000 + 7820
16 TheLearningMachine 0x00002be4 0x1000 + 7140
17 TheLearningMachine 0x000029b6 0x1000 + 6582
18 UIKit 0x0000e47a -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 766
19 UIKit 0x000049e0 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 200
20 UIKit 0x0005dfd6 -[UIApplication handleEvent:withNewEvent:] + 1390
21 UIKit 0x0005d8fa -[UIApplication sendEvent:] + 38
22 UIKit 0x0005d330 _UIApplicationHandleEvent + 5104
23 GraphicsServices 0x00005044 PurpleEventCallback + 660
24 CoreFoundation 0x00034cdc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION + 20
25 CoreFoundation 0x00034ca0 __CFRunLoopDoSource1 + 160
26 CoreFoundation 0x00027566 __CFRunLoopRun + 514
27 CoreFoundation 0x00027270 CFRunLoopRunSpecific + 224
28 CoreFoundation 0x00027178 CFRunLoopRunInMode + 52
29 UIKit 0x000040fc -[UIApplication _run] + 364
30 UIKit 0x00002128 UIApplicationMain + 664
31 TheLearningMachine 0x00002948 0x1000 + 6472
32 TheLearningMachine 0x000028fc 0x1000 + 6396
Thread 1:
0 libSystem.B.dylib 0x0002d330 kevent + 24
1 libSystem.B.dylib 0x000d6b6c _dispatch_mgr_invoke + 88
2 libSystem.B.dylib 0x000d65bc _dispatch_queue_invoke + 96
3 libSystem.B.dylib 0x000d675c _dispatch_worker_thread2 + 120
4 libSystem.B.dylib 0x0007a67a _pthread_wqthread + 258
5 libSystem.B.dylib 0x00073190 start_wqthread + 0
Thread 2:
0 libSystem.B.dylib 0x0007b19c __workq_kernreturn + 8
1 libSystem.B.dylib 0x0007a790 _pthread_wqthread + 536
2 libSystem.B.dylib 0x00073190 start_wqthread + 0
Thread 3:
0 libSystem.B.dylib 0x00000c98 mach_msg_trap + 20
1 libSystem.B.dylib 0x00002d64 mach_msg + 44
2 CoreFoundation 0x00027c38 __CFRunLoopServiceMachPort + 88
3 CoreFoundation 0x000274c2 __CFRunLoopRun + 350
4 CoreFoundation 0x00027270 CFRunLoopRunSpecific + 224
5 CoreFoundation 0x00027178 CFRunLoopRunInMode + 52
6 WebCore 0x000024e2 RunWebThread(void*) + 362
7 libSystem.B.dylib 0x0007a27e _pthread_start + 242
8 libSystem.B.dylib 0x0006f2a8 thread_start + 0
Thread 0 crashed with ARM Thread State:
r0: 0x00000000 r1: 0x00000000 r2: 0x00000001 r3: 0x3e0862b4
r4: 0x00000006 r5: 0x0015a2ec r6: 0x2fffe090 r7: 0x2fffe0a0
r8: 0x3e1a378c r9: 0x00000065 r10: 0x33028e5a r11: 0x3e1ab89c
ip: 0x00000025 sp: 0x2fffe0a0 lr: 0x30277abf pc: 0x30277ac8
cpsr: 0x000f0010
Any idea what the problem can be ?
I've already spent my whole day on that, but... I'm stuck.
Thanks in advance...
Miky Mike
Ok, Here is more then from the console, I get this :
This GDB was configured as "--host=i386-apple-darwin --target=arm-apple-darwin".tty /dev/ttys002
Loading program into debugger…
Program loaded.
target remote-mobile /tmp/.XcodeGDBRemote-17280-65
Switching to remote-macosx protocol
mem 0x1000 0x3fffffff cache
mem 0x40000000 0xffffffff none
mem 0x00000000 0x0fff none
run
Running…
Error launching remote program: failed to get the task for process 456.
Error launching remote program: failed to get the task for process 456.
The program being debugged is not being run.
The program being debugged is not being run.
[Session started at 2010-12-23 20:33:33 +0100.]
GNU gdb 6.3.50-20050815 (Apple version gdb-1472) (Thu Aug 5 05:54:10 UTC 2010)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i386-apple-darwin --target=arm-apple-darwin".tty /dev/ttys004
Loading program into debugger…
Program loaded.
target remote-mobile /tmp/.XcodeGDBRemote-17280-72
Switching to remote-macosx protocol
mem 0x1000 0x3fffffff cache
mem 0x40000000 0xffffffff none
mem 0x00000000 0x0fff none
run
Running…
Error launching remote program: failed to get the task for process 508.
Error launching remote program: failed to get the task for process 508.
The program being debugged is not being run.
The program being debugged is not being run.
And here is the code page that calls the URL
import "TheLearningMachineAppDelegate.h"
import "RootViewController.h"
@implementation TheLearningMachineAppDelegate
@synthesize window;
@synthesize navigationController;
pragma mark -
pragma mark Application lifecycle
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
RootViewController *rootViewController = (RootViewController *)[navigationController topViewController];
rootViewController.managedObjectContext = self.managedObjectContext;
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
return YES;
}
(void)applicationWillResignActive:(UIApplication )application {
/
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
*/
}
(void)applicationDidEnterBackground:(UIApplication *)application {
[self saveContext];
}
(void)applicationWillEnterForeground:(UIApplication )application {
/
Called as part of the transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
*/
}
(void)applicationDidBecomeActive:(UIApplication )application {
/
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
*/
}
// Method that saves the managed object context before the application terminates.
(void)applicationWillTerminate:(UIApplication *)application {
[self saveContext];
}
(void)saveContext {
NSError *error = nil;
if (managedObjectContext != nil) {
if ([managedObjectContext hasChanges] && ![managedObjectContext save:&error]) {
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
//Replace this implementation with code to handle the error appropriately.
//abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. If it is not possible to recover from the error, display an alert panel that instructs the user to quit the application by pressing the Home button.
}
}
}
pragma mark -
pragma mark Core Data stack
// Returns the managed object context for the application.
(NSManagedObjectContext *)managedObjectContext {
if (managedObjectContext != nil) {
return managedObjectContext;
}
NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator];
if (coordinator != nil) {
managedObjectContext = [[NSManagedObjectContext alloc] init];
[managedObjectContext setPersistentStoreCoordinator:coordinator];
}
return managedObjectContext;
}
// Returns the managed object model for the application.
(NSManagedObjectModel *)managedObjectModel {
if (managedObjectModel != nil) {
return managedObjectModel;
}
NSString *modelPath = [[NSBundle mainBundle] pathForResource:@"TheLearningMachine" ofType:@"momd"];
NSURL *modelURL = [NSURL fileURLWithPath:modelPath];
managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
return managedObjectModel;
}
pragma mark -
pragma mark Application's Documents directory
// Returns the path to the application's Documents directory.
- (NSString *)applicationDocumentsDirectory {
return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
}
// Returns the persistent store coordinator for the application.
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator {
if (persistentStoreCoordinator != nil) {
return persistentStoreCoordinator;
}
NSURL *storeURL = [NSURL fileURLWithPath: [[self applicationDocumentsDirectory] stringByAppendingPathComponent: @"TheLearningMachine.sqlite"]];
NSError *error = nil;
persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]];
if (![persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) {
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
return persistentStoreCoordinator;
}
pragma mark -
pragma mark Memory management
(void)applicationDidReceiveMemoryWarning:(UIApplication )application {
/
Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
*/
}
(void)dealloc {
[managedObjectContext release];
[managedObjectModel release];
[persistentStoreCoordinator release];
[window release];
[super dealloc];
}
@end