Я новичок в программировании iphone.Я использую localNotification в моем приложении. Он дает предупреждение пользователю и отвечает на запуск с помощью didReceiveLocalNotification. Но моя проблема заключается в том, что если пользователь закрывает UILocalNotification в моем приложении, мне нужно выполнить операцию базы данных. Так как я могу это сделать?подход к этому.
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
NSDate* now = [NSDate date];
[localNotification setFireDate:now];
localNotification.soundName=@"Tink.wav";
[localNotification setAlertAction:@"Launch"];
[localNotification setAlertBody:@"You have entered to Your Place:"];
[localNotification setHasAction: YES];
NSDictionary *userDict = [NSDictionary dictionaryWithObject:@"obj" forKey:kRemindMeNotificationDataKey];
localNotification.userInfo = userDict;
- (void)application:(UIApplication *)app didReceiveLocalNotification:(UILocalNotification *)notif {
NSLog(@"Recieved Notification");
NSString *DateString=[notif.userInfo valueForKey:kRemindMeNotificationDataKey];
if([DateString isEqualToString:@"obj"])
{
[[UIApplication sharedApplication] cancelLocalNotification:notif];
}
NSString *strNotif=[notif.userInfo objectForKey:kRemindMeNotificationDataKey];
if ([strNotif isEqualToString:@"obj"]) {
UIAlertView *alretCheck=[[UIAlertView alloc]initWithTitle:@"notifi Testing in DidRec+" message:strNotif delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alretCheck show];
[alretCheck release];
}
Заранее благодарю.