推送通知设备令牌? [英] Push Notification Device Token?

查看:35
本文介绍了推送通知设备令牌?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从我的 iPhone 设备获取设备令牌?

How to get Device Token from my iPhone Device?

推荐答案

这个方法会在调试模式下在控制台打印 deviceToken,如果你想看到设备令牌你也可以在 UIAlert 中看到.

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];

}

这篇关于推送通知设备令牌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆