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); 
     } 
    }]; 

答えて

3

おかげで目に見える「クリア」ボタンを持っているあなたの行動は、ユーザーご通知を力が、接触したときに表示されます。そのショットを与え、あなたの行動を見なければなりません。

+0

Patrick、ありがとう!あなたは正しかった。回答の遅れて受け入れて申し訳ありませんが、私はあなたの答えの日を見ました... –

+0

私は私のために働いていない同じをやっている –

関連する問題