you can do this handling in
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
Frage
hello i am working on a application with LocalNotifications
. I want to make a handler that when the user tap on a notification in NotificationBar
it will show him new Viewctontroler with Title and Descr that recieve from Notification.
UILocalNotification *notif;
for(int i=0 ; i<[idnoty count]; i++){
notif=[[UILocalNotification alloc]init];
if (notif == nil) return;
notif.fireDate = [NSDate date];// Now here you can manage the fire time.
notif.timeZone = [NSTimeZone defaultTimeZone];
[notif setHasAction:NO];
notif.timeZone = [NSTimeZone localTimeZone];
notif.alertBody = [titlenoty objectAtIndex:i];
notif.alertAction=[descrnoty objectAtIndex:i];
notif.applicationIconBadgeNumber = i+1;
notif.soundName = UILocalNotificationDefaultSoundName;
NSDictionary *infoDict = [NSDictionary dictionaryWithObjectsAndKeys:@"Object 2",@"Key 2", nil];
notif.userInfo = infoDict;
//apostolh gia na svisei ta push
NSString *URLTest=[dict objectForKey:@"URL"];
NSString *URL1=[NSString stringWithFormat:@"%@%@",URLTest,@"push.php?"];
NSString *strURL1 = [NSString stringWithFormat:@"%@id=%@",URL1,[idnoty objectAtIndex:i]];
NSData *dataURL1 = [NSData dataWithContentsOfURL:[NSURL URLWithString:strURL1]];
[[UIApplication sharedApplication] scheduleLocalNotification:notif ];
}
Lösung
you can do this handling in
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification