APN测试推送通知

3
我已经下载并安装了APN Free Tester app应用程序,因为我正在尝试调试我的推送通知设置:

测试器调试界面显示以下内容,没有错误,但它没有显示消息,也没有在应用程序中显示消息。

我可以得出结论,令牌和证书都正确设置,否则它会生成一个错误。

任何建议都将不胜感激。

发送的有效负载

{  
  "aps":{  
    "alert":"Hello from APNs Tester.",
    "badge":"1"
  }
}

2016年04月04日 09:55:15 +0000: 已连接
2016年04月04日 09:55:17 +0000: 令牌: <1dc3651f 54cdead8 65g5cc35 7287376d d796f3a2 2afabab1 ff80ddd4 e55eeab1>
2016年04月04日 09:55:17 +0000: 发送92字节的数据到gateway.sandbox.push.apple.com:2195
2016年04月04日 09:55:17 +0000: 已断开与服务器gateway.sandbox.push.apple.com:2195的连接

2个回答

1
我非常希望APNS测试工具是开源代码,可以编译和运行在MacOS应用程序Push Me Baby中。然后按照以下步骤进行。
  1. Open the PushMeBaby application in Xcode.
  2. Right-click on the Resources folder in Xcode and select Add Existing Files…. Select the aps.developer.identity.cer file that you have downloaded earlier enter image description here

  3. In the ApplicationDelegate.m file, modify the code as shown below:

    - (id)init {
        self = [super init];
        if(self != nil) {
            self.deviceToken = @"38c866dd bb323b39 ffa73487 5e157ee5 a85e0b7c e90d56e9 fe145bcc 6c2c594b";
    
            self.payload = @"{"aps":{"alert":"You got a new message!","badge":5,"sound":"beep.wav"},"acme1":"bar","acme2":42}";
    
            self.certificate = [[NSBundle mainBundle]
                                pathForResource:@"aps_developer_identity" ofType:@"cer"];
        }
        return self;
    

    }

  4. Press Command-R to test the application. You will be asked to grant access to the certificate. Click Always Allow

  5. If the message is pushed correctly, you should see the notification

从这里下载代码

希望这能对你有所帮助。


0

APN Tester Free无法显示发送结果,它只会尝试发送数据而不进行确认。 请确保您的证书和令牌都是用于开发或生产。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接