###前提・実現したいこと
iOSでpush通知機能を作成しています。
amazon snsと連携したpush通知を実装しようとしているのですが、
push通知音が変更できません。
原因の切り分けのため、localNotificationを利用して通知音を鳴らそうとしても
上手く行きませんでした。
やり方を教えて下さい。
設定は上記のように追加しています。
###該当のソースコード
ここにご自身が実行したソースコードを書いてください
-
(void) nextButtonSelected: (UIButton *)button {
//Amazon SNS
NSLog(@"Registering for push notifications...");
[self.popUp dismiss:YES];
UIUserNotificationSettings *setting = [UIUserNotificationSettings settingsForTypes: (UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert) categories:nil];[[UIApplication sharedApplication] registerUserNotificationSettings:setting];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
-(void) application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler {
[PFPush handlePush:userInfo];
NSLog(@"didReceiveRemoteNotification Notification");
pushCount = pushCount + 1;
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
localNotification.fireDate = [NSDate date];
localNotification.timeZone = [NSTimeZone localTimeZone];
localNotification.applicationIconBadgeNumber = pushCount;
localNotification.soundName = @"out.caf";
[application scheduleLocalNotification:localNotification];
[application setApplicationIconBadgeNumber:pushCount];
}
// Local Notificationの場合
- (void)application:(UIApplication *)application
handleActionWithIdentifier:(NSString *)identifier
forLocalNotification:(UILocalNotification *)notification
completionHandler:(void(^)())completionHandler {
NSLog(@"Local Notification");
[application setApplicationIconBadgeNumber:pushCount];
}
###試したこと
mp3でテスト
wavファイルでテスト
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。