2009-10-03 66 views
3

在我的iphone应用程序中,我希望使用APN的设备令牌。 如何获得使用代码?如何使用Iphone应用程序获得设备令牌以及有关设备的其他信息?

我想要的其他信息有关设备用户,其版本和其他信息的其他信息。 如何获得使用代码?

是否可以使用设备令牌获取设备的其他信息?

设备令牌的格式是什么?

请通过代码或任何链接或任何其他方式给予解决方案,这将不胜感激。

感谢,

米沙勒沙阿

回答

7

这里你如何获得有关设备的信息---

NSString* deviceName= [[UIDevice currentDevice] uniqueIdentifier]; 
NSString* localizedModel=[[UIDevice currentDevice] localizedModel]; 
NSString* systemVersion=[[UIDevice currentDevice] systemVersion]; 
NSString* systemName=[[UIDevice currentDevice] systemName]; 
NSString* model=[[UIDevice currentDevice] model]; 
+2

这不接你的设备令牌从APN .. – Krishnan 2011-09-09 05:22:01

+0

是,但它仍然必须与APN一起使用。来自APN的令牌可能会发生变化,您不能依靠它来识别提供商的设备。您应该获得唯一的ID和APN令牌ID,并在注册时将其发送给提供商。 – 2012-09-26 17:53:46

14
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeAlert ]; 
} 

// Delegation methods 
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { 
    NSLog(@"didRegisterForRemoteNotificationsWithDeviceToken: %@", deviceToken); 
} 
相关问题