我使用http://stefan.hafeneger.name/download/PushMeBabySource.zip
的服务器的链接我使用PushMeBaby服务器并使用我的证书和配置文件推送应用程序,它以设备上的警报形式发出通知,并且仅在我第一次运行应用程序时在方法上打印语句,但在运行应用程序时接下来多次测试它只返回设备令牌,以下方法根本不执行。请帮我解决这个问题。
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
for (id key in userInfo) {
NSLog(@”key: %@, value: %@”, key, [userInfo objectForKey:key]);
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@”alert” message:key delegate:self cancelButtonTitle:@”ok” otherButtonTitles:nil];
[alert show];
/*if(key)
{
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@”alert” message:@”this is in application” delegate:self cancelButtonTitle:@”ok” otherButtonTitles:nil];
[alert show];
}*/
}
}
请尽快帮助我
答案 0 :(得分:3)
每次启动应用程序时都需要获取令牌。有时它会改变。
答案 1 :(得分:2)
The delegate (didReceiveRemoteNotification) gets invoked when a running application receives a remote notification.
If you implement application:didFinishLaunchingWithOptions: to handle an incoming push notification that causes the launch of the application, this method (didReceiveRemoteNotification) is not invoked for that push notification.
有关推送通知的详细信息,请参阅:
developer apple-ApplePushService