アプリがバックグラウンドにある間に地域を入力すると、場所のアップデート、テストの実行のためにアプリが登録されています。いつか私は通知センターで通知を見るだけで、私はどんな音や警告も受けていませんでした。 いつも音と警告の通知を受けるために何ができますか?Iphone presentLocalNotification Nowはアプリをバックグラウンドで起動している間、アラートやサウンドを起動しません。
これは私が私の見解で持っているもの
UILocalNotification *localNotif = [[UILocalNotification alloc] init];
localNotif.fireDate = nil;
localNotif.hasAction = YES;
localNotif.alertBody = fbName;
localNotif.alertAction = @"View";
localNotif.soundName = UILocalNotificationDefaultSoundName;
[[UIApplication sharedApplication]presentLocalNotificationNow:localNotif];
であり、アプリケーションがバックグラウンドで実行されている場合、このアプリのデリゲート
- (void)application:(UIApplication *)application didReceiveLocalNotification (UILocalNotification *)notification
{
if (notification)
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Alert"
message:notification.alertBody
delegate:self cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
facebook = [[Facebook alloc] initWithAppId:kAppId andDelegate:self];
UILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];
if (notification)
{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Alert"
message:notification.alertBody
delegate:self cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}
return YES;
}
[UILocalnotificationアプリケーションがバックグラウンドにあるときに表示されない]の可能な重複(http://stackoverflow.com/questions/10367400/uilocalnotification-is-not-appearing-when-the-application-is -in-the-background) –
私はこれが全く同じだとは思わない、それはいくつかのケースで動作するように、それは私のために背景にあった時間とは関係があるようだ、それは状態の周りを回るそのアプリケーションがバックグラウンドでUILocalNotificationの動作が矛盾しているように見える場合は誰でもこれを体験できますか? – Brett