私はこのコードを持っています:
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。ユーザーがボタンをクリックしたときにこれとまったく同じことが起こるようにしたかったので、ViewControllernotにこのコードが必要AppDelegateです。で同じことができるように、このコードを変更するにはどうすればよいですかViewController! 本当にありがとう!