2009-10-03 63 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); 
} 
相關問題