我試圖使用蘋果提供的推送通知服務,但我無法獲取推送通知所需的設備令牌。我使用下面的代碼使用下面的代碼如何獲得推送通知iphone的devicetoken?
[[UIApplication sharedApplication]
registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeAlert |
UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound)];
誰能幫我這...
我檢索設備令牌
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken
{
const void *devTokenBytes = [devToken bytes];
NSLog(@"devToken=%@",devTokenBytes);
//[self alertNotice:@"" withMSG:[NSString stringWithFormat:@"devToken=%@",devToken] cancleButtonTitle:NSLocalizedString(@"OK",@"") otherButtonTitle:@""];
//self.registered = YES;
//[self sendProviderDeviceToken:devTokenBytes]; // custom method
}
- (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err
{
NSLog(@"Error in registration. Error: %@", err);
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
for (id key in userInfo)
{
NSLog(@"key: %@, value: %@", key, [userInfo objectForKey:key]);
}
}
我註冊了遠程通知我在控制檯窗口中顯示以下警告消息
warning: Unable to read symbols for "/Library/MobileSubstrate/MobileSubstrate.dylib" (file not found).
難道是做了越獄的iPhone的東西...
Thanx提前...
你是否能夠解決他的問題,因爲我也在jailbroken iphone上測試我的應用程序,並且在嘗試從蘋果獲取設備令牌時沒有調用任何委託方法。另外我也有同樣的警告。 – 2010-06-09 06:24:01