Push Notification Device Token?

前端 未结 3 951
无人共我
无人共我 2021-01-29 23:12

How to get Device Token from my iPhone Device?

3条回答
  •  Happy的楠姐
    2021-01-30 00:00

    this method will print the deviceToken in console in debug mode, if you want to see the device token you can see in UIAlert also.

    - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
        NSLog(@"APN device token: %@", deviceToken);
        NSString *deviceTokenString = [NSString stringWithFormat:@"%@",deviceToken];
        UIAlertView *deviceTokenAlert = [[UIAlertView alloc] initWithTitle:@"Device Token"
                                                                message:deviceTokenString
                                                               delegate:self
                                                      cancelButtonTitle:@"OK"
                                                      otherButtonTitles:nil];
    
    }
    

提交回复
热议问题