[Objective Cの中に]サウンドを再生しないとバッジアラートを表示しませんプッシュ通知:iOSのは、私がここで提供デモ命令を使用していた
:ここ https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/IPhoneOSClientImp.htmlhttps://developer.apple.com/library/ios/documentation/UIKit/Reference/UIAlertController_class/
はメインのコードです
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UIUserNotificationType types = (UIUserNotificationType) (UIUserNotificationTypeBadge |
UIUserNotificationTypeSound | UIUserNotificationTypeAlert);
UIUserNotificationSettings *mySettings =
[UIUserNotificationSettings settingsForTypes:types categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:mySettings];
return YES;
}
-(void)MessageBox:(NSString *)title message:(NSString *)messageText
{
// OLD way of sending push notifications:
// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:messageText delegate:self
// cancelButtonTitle:@"OK" otherButtonTitles: nil];
// [alert show];
UIAlertController* alert= [UIAlertController
alertControllerWithTitle:title
message:messageText
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {}];
[alert addAction:defaultAction];
[self.window.rootViewController presentViewController:alert animated:YES completion:nil];
}
通知が表示されますが、サウンドとバッジの更新はありません。 提案がありますか?
実際にあなたのサーバーのAPNSにリモート通知を送信しているのですか、アプリでローカル通知を使用していますか?あなたがしているのは、バッジとサウンドがないという意味の警告ダイアログを表示しているようです。 –
両方のフィードバックありがとう。私は完全にはっきりしていなかった。コードでバッジとサウンドを設定していました。その後、サードパーティのペイロードを送信します。私のペイロードメッセージは不完全でした。 –