私はこのコードを持っています:
UILocalNotification *notification = [[UILocalNotification alloc] init]; [notification setAlertBody:@"This is a message"]; [notification setFireDate:[NSDate dateWithTimeIntervalSinceNow:10]]; [notification setTimeZone:[NSTimeZone defaultTimeZone]]; [application setSchedualLocalNotifications:[NSArray arrayWithObject:notification]];
これはAppDelegate.m
またはでは正常に機能します(-(void) applicationDidEnterBackground:(UIApplication *)application)
が、 では機能しませんViewController
。ユーザーがボタンをクリックしたときにこれとまったく同じことが起こるようにしたかったので、ViewController
notにこのコードが必要AppDelegate
です。で同じことができるように、このコードを変更するにはどうすればよいですかViewController
! 本当にありがとう!