0
通知フレームワークを実装しようとしていますが、インタラクティブ通知で2つのアクションボタンが表示されない理由を知っていますか?私は左にスワイプすると、私は唯一のiOS 10で事前通知ビューの対話アクションがiOS 10(xcode 8)で表示されない
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;
[center requestAuthorizationWithOptions:(UNAuthorizationOptionSound | UNAuthorizationOptionAlert | UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error)
{
if(!error)
{
NSLog(@"Push registration success.");
// create actions
UNNotificationAction *ackAction = [UNNotificationAction actionWithIdentifier:@"com.elonchan.yes"
title:@"Acknowledge"
options:UNNotificationActionOptionForeground];
UNNotificationAction *detailsAction = [UNNotificationAction actionWithIdentifier:@"com.elonchan.no"
title:@"Details"
options:UNNotificationActionOptionForeground];
NSArray *notificationActions = @[ ackAction, detailsAction ];
// create a category
UNNotificationCategory *inviteCategory = [UNNotificationCategory categoryWithIdentifier:@"com.elonchan.localNotification"
actions:notificationActions
intentIdentifiers:@[]
options:UNNotificationCategoryOptionCustomDismissAction];
NSSet *categories = [NSSet setWithObject:inviteCategory];
// registration
[center setNotificationCategories:categories];
[[UIApplication sharedApplication] registerForRemoteNotifications]; // required to get the app to do anything at all about push notifications
NSLog(@"Push rsetNotificationCategories success.");
}
else
{
NSLog(@"Push registration FAILED");
NSLog(@"ERROR: %@ - %@", error.localizedFailureReason, error.localizedDescription);
NSLog(@"SUGGESTIONS: %@ - %@", error.localizedRecoveryOptions, error.localizedRecoverySuggestion);
}
}];
Patrick、ありがとう!あなたは正しかった。回答の遅れて受け入れて申し訳ありませんが、私はあなたの答えの日を見ました... –
私は私のために働いていない同じをやっている –