iphone - 推送通知

标签 iphone ios7 push-notification

我使用的服务器链接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/

相关文章:

android - Pushwoosh/GCM - Android - 不接收消息

cordova - 无法将推送通知插件添加到 cordova 中

ios - Parse.com - 将指针从用户类设置为安装类

iphone - 将视频复制到 uipasteboard

ios - 我如何实际检查在后台传输服务中,即使应用程序挂起、退出或崩溃,传输也会在后台继续

ios - 自定义 UIBackButtonItem 和 UINavigationController 手势

objective-c - 如何使我的导航栏统一半透明?

iphone - 滑动删除不适用于自定义单元格

iphone - 重新输入选项卡时更新 UITableView

iphone - presentViewController 应该完成什么?