Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone application crash (iOS4 Only)

My iPhone application occasionally crashs the first time it is run after being installed. After this every time i try and run the app it remains on the splash screen or even a black screen until eventually it dies. I have to restart the device to get the application to work. After this it works fine every time. The only change between the OS3 code and 4 is the property 'UIApplicationExitsOnSuspend' to force the app to reload every time instead of suspending. Any help would be great.

Here are the two Code snippets:

- (void)applicationDidFinishLaunching:(UIApplication *)application 
{  
    taskListViewController = [[TaskListViewController alloc] initWithNibName:@"TaskListView" bundle:nil];
    taskListViewController.managedObjectContext = self.managedObjectContext;

    [taskListViewController setAppDefaults];

    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:taskListViewController];
    [taskListViewController release];

    navController.navigationBar.tintColor = [UIColor blackColor];

    [window addSubview:[navController view]];
    [window makeKeyAndVisible];

}

- (void)viewDidLoad 
{
    NSLog(@"viewDidLoad - Start");
    [super viewDidLoad]; 

    NSError *error = nil;
    if(![[self fetchedResultsController] performFetch:&error])
    {
     NSLog(@"Error with initial fetch %@, %@", error, [error userInfo]);
    }

    [activityIndicator startAnimating];

    self.navigationItem.leftBarButtonItem.enabled = NO;
    self.navigationItem.rightBarButtonItem.enabled = NO;
    infoButton.enabled = NO;
    syncButton.enabled = NO;

    taskListTable.userInteractionEnabled = NO;
    taskListTable.allowsSelection = NO;

    checkingRecovery = true;
    [self insertCheck];
}

Other Methods mentioned above:

    [taskListViewController setAppDefaults]
    [self insertCheck];

setAppDefaults - Enumerates through the settings bundle applying the defaultValues to NSUserDefaults if they have not been set already by the user in peferences.

insertCheck - Performs some queries on the db to ensure file integrity on audio recordings but in this case as this is the first time the app is loaded it will do nothing.

Update:

I have commented out the extra method calls (the two above) and i am still having the problem.

I have found a few people having the same sort of problem on the apple developer forum with no solutions. One reply was from a user having the same problem but there application did get approved on the app store.

Thanks Sj

like image 359
Sjblack Avatar asked Jul 21 '10 12:07

Sjblack


People also ask

Why do apps on my iPhone randomly crash?

Random and frequent app crashes in mobile devices usually denote a memory issue like when the device is running low on storage. Other performance issues including symptoms of sluggishness, unresponsiveness and random restarts are also likely to transpire in this case.

How do you fix an app that keeps crashing without deleting it?

To fix Android apps that keep crashing: To do this, go to Settings and open Apps. Under Your apps, you'll see a list of the apps currently installed on your device. From the list, tap the app that keeps crashing and tap Force stop in the bottom right corner. Then try opening the app again.

Why do my apps crash out of nowhere?

If your Android apps keep crashing or freezing it's usually because you're low on space or running too many apps at once. Other reasons for crashing apps include a spotty Wi-Fi connection or an old version of the app that hasn't been updated.


1 Answers

If you are debugging the application when it crashes, you should get a stack trace, which will show you on what line the application crashes.

If you could provide the stack trace it would be much easier to find the cause of the crash.

like image 130
Erik B Avatar answered Nov 10 '22 00:11

Erik B