Wednesday, April 04, 2012

How to remind users to Restart App

-(void)applicationDidEnterBackground:(UIApplication *)application
{
    UILocalNotification *localNotification = [[[UILocalNotification alloc] init] autorelease];
   
    // Current date
    NSDate *date = [NSDate date];
   
    // Add interval to the current time
    NSDate *dateToOpen = [date dateByAddingTimeInterval:timeInterval];
   
    // Set the fire date/time
    [localNotification setFireDate:dateToOpen];
    [localNotification setTimeZone:[NSTimeZone defaultTimeZone]];   
   
    // Setup alert notification
    [localNotification setAlertBody:@"Tap to return to MyApp" ];
    [localNotification setAlertAction:@"Open MyApp"];
    [localNotification setHasAction:YES];
   
    [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
}

No comments:

Swift Operators - Basic Part 3 (Range operators in swift)

Range Operators: Closed Range operators  Half-Open Range Operators One-Sided Ranges Closed Range Operators:  a...b It defines...