我试图使用苹果提供的推送通知服务,但我无法获取推送通知所需的设备令牌。我使用下面的代码使用下面的代码如何获得推送通知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