inadvance 푸시 알림을 수신하는 방법도 변경되었습니다
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier
더 많은 정보를 원하시면 Handling Local and Remote Notifications 및 UIApplicationDelegate를 참조하십시오. 내 경우에는
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
NSLog(@"Requesting permission for push notifications..."); // iOS 8
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:
UIUserNotificationTypeAlert | UIUserNotificationTypeBadge |
UIUserNotificationTypeSound categories:nil];
[UIApplication.sharedApplication registerUserNotificationSettings:settings];
} else {
NSLog(@"Registering device for push notifications..."); // iOS 7 and earlier
[UIApplication.sharedApplication registerForRemoteNotificationTypes:
UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound];
}
return YES;
}
- (void)application:(UIApplication *)application
didRegisterUserNotificationSettings:(UIUserNotificationSettings *)settings
{
NSLog(@"Registering device for push notifications..."); // iOS 8
[application registerForRemoteNotifications];
}
- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)token
{
NSLog(@"Registration successful, bundle identifier: %@, device token: %@",
[NSBundle.mainBundle bundleIdentifier], token);
}
- (void)application:(UIApplication *)application
didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
NSLog(@"Failed to register: %@", error);
}
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier
forRemoteNotification:(NSDictionary *)notification completionHandler:(void(^)())completionHandler
{
NSLog(@"Received push notification: %@, identifier: %@", notification, identifier); // iOS 8
completionHandler();
}
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)notification
{
NSLog(@"Received push notification: %@", notification); // iOS 7 and earlier
}
작동하지 : 여기
는 응용 프로그램 위임의 전체 예입니다? 나는이 새로운 변화에 관한 어떤 문서도 찾지 못했습니까? 유용한 링크를주세요. – iphonemaclover