Detect if application: didReceiveRemoteNotification: fetchCompletionHandler: was called by tapping on a notification in Notification Center

前端 未结 8 1941
北荒
北荒 2021-01-30 16:38
application: didReceiveRemoteNotification: fetchCompletionHandler:

is different from

application: didReceiveRemoteNotification:
         


        
8条回答
  •  情书的邮戳
    2021-01-30 17:33

    You could check the UIApplication's applicationState to distinguish silent calls from calls made with the application being actively used by the user:

    typedef enum : NSInteger {
       UIApplicationStateActive,
       UIApplicationStateInactive,
       UIApplicationStateBackground
    } UIApplicationState;
    

    Or keep your own flag set on the delegate's applicationDidEnterBackground:.

提交回复
热议问题