を呼び出すアプリがありますが、 /var/mobile/ Applicationsではなく/ApplicationsscheduleLocalNotification
にインストールすると機能しません。
- (void) doNotify
{
// this doesn't work when app is in /Applications but does in /var/mobile/Applications
UILocalNotification * theNotification = [[UILocalNotification alloc] init];
theNotification.alertBody = @"Finished processing.";
theNotification.alertAction = @"Ok";
theNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:1];
[[UIApplication sharedApplication] scheduleLocalNotification:theNotification];
NSLog(@"notification scheduled: %@", theNotification);
}
presentLocalNotification
タイミングの問題だった場合に備えて、代わりに試しました。
アプリデリゲートに実装didReceiveLocalNotification
して、代わりに呼び出されているかどうかを確認しましたが、そうではありませんでした。アプリがフォアグラウンドにあるときにのみ呼び出されました。
アプリを/var/mobile/Applicationsに戻すと、正常に動作します。Xcode 4.2.1 を使用し、iPhone 4S および iPod Touch 4g で iOS 5.1.1 を実行しています。
編集:音楽アプリなので、アプリはバックグラウンドで実行できます