我使用的服务器链接http://stefan.hafeneger.name/download/PushMeBabySource.zip
我使用 PushMeBaby 服务器和推送应用程序以及我的证书和配置文件,它以警报的形式在设备上发出通知,并仅在我第一次运行应用程序时在控制台上打印以方法编写的语句,但在运行应用程序时接下来多次测试它只返回设备 token ,以下方法根本不执行。请帮我解决这个问题。
- (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];
}*/
}
}
请尽快帮助我
最佳答案
每次启动应用程序时都需要获取 token 。有时它会改变。
关于iphone - 推送通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7282759/