Summarize the response method of iOS receiving remote push
(1) - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
(2) - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
(3) - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler
(4) - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)())completionHandler
(5) - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler
launchOptions
Saves the reason for the app to start. If the app is started by clicking on the notification bar, you can get the specific content of the notification at launchOptions
completionHandler
The parameter UIBackgroundFetchResult
that this block can fill in is an enumeration value. It is mainly used to perform some operations in the background state, such as requesting data. After the operation is completed, the system must be notified that the acquisition is completed. The available results are typedef NS_ENUM(NSUInteger, UIBackgroundFetchResult) {
UIBackgroundFetchResultNewData,
UIBackgroundFetchResultNoData,
UIBackgroundFetchResultFailed
}
Indicates that new data is obtained (at this time, the system will take a screenshot of the current UI state and update the screenshot of your app in the App Switcher), no new data, and failed to obtain. However, the premise of the above operation is that Background Modes
(push wake-up) has been checked in Remote notifications
and the pushed message contains the content-available
field.UNUserNotificationCenterDelegate
proxy method newly added in iOS 10. In the iOS 10 environment, this method will be called when clicking on the notification bar. UNUserNotificationCenterDelegate
The proxy method. Before iOS 10, if the app was in the foreground state and received a push, the notification bar would not give any prompts. If the developer needs to display the notification, he needs to 3 methods to extract the notification content display. In iOS 10, if the developer needs to display the notification in the foreground, the corresponding parameter can be passed in completionHandler
in this method. typedef NS_OPTIONS(NSUInteger, UNNotificationPresentationOptions) {
UNNotificationPresentationOptionBadge = (1 << 0),
UNNotificationPresentationOptionSound = (1 << 1),
UNNotificationPresentationOptionAlert = (1 << 2),
}
Summary: (minimum system environment is iOS 7)content-available
field, execute methods 3 and 4, otherwise only execute 4. Method 3 will be executed in the case of non-iOS 10. Background Modes
(push wakeup) has been checked in Remote notifications
and the pushed message contains the content-available
field, method 3 will be executed. Clicking the notification bar iOS 10 will execute method 4, non-iOS10 will execute method 3. 이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.