远程推送

UIApplicationLaunchOptionsRemoteNotificationKey这个是远程推送远程用户点击推送进入到app后会走didFinishLauch方法,这个key计时launchOptions带过来的远程参数

ios7-的版本推送走的方法
application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo

ios7+走的推送方法
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler 

//注册APNs成功并上报DeviceToken
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    
    // Required
    [APService registerDeviceToken:deviceToken];
}

//实现注册APNs失败接口(可选)

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
    //Optional
    NSLog(@"did Fail To Register For Remote Notifications With Error: %@", error);
}

你可能感兴趣的:(远程推送)