Anupama
Anupama

Reputation: 373

ios-App crashes unexpectedly when re Enters to the app

When I enter the app it is working fine but when I re-enter the app it will not shown the particular page or starting page of the app but it is again displaying the Launcher image and crashes and after crash again it is working fine.

[NSThread sleepForTimeInterval:1.0]; 
UILocalNotification *locationNotification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey]; 
if (locationNotification) { 
    // Set icon badge number to zero 
    NSLog(@"Recieved Notification %@",locationNotification); 
} 
return YES; 

please give the solution I am new bee to iOS.

Upvotes: 0

Views: 103

Answers (2)

iEinstein
iEinstein

Reputation: 2100

Anupma

From seeing the problem which is described here I suspect some methods or notifications are calling in applicationDidEnterBackground. Please check it and if it is you can find the solution to solve it.

Hope this helps.

Upvotes: 1

Anupama
Anupama

Reputation: 373

-(void)applicationDidEnterBackground:(UIApplication *)application
{

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{

        [self Backgroundmethods];



        dispatch_async(dispatch_get_main_queue(), ^{

            //your code to update UI if any goes here



        });

    });

  }

I worte the all my background methods in seperate method and calling that method with in applicationdidEnterbackground in seperate thread.

Upvotes: 0

Related Questions