java - Grails 应用程序,使用 java-apns

标签 java iphone grails apple-push-notifications

我有一个 grails 应用程序,并且我正在使用 java-apns 0.1.5 jar!我有一个设备 key ,它已经从中卸载了我的应用程序,所以我的问题是,我是否应该从 API 收到相同的反馈,说明设备不再启用? 我的代码如下:

apnsService = APNS.newService()
        .withCert(pathToCertificate, password)
        .withFeedbackDestination("feedback.sandbox.push.apple.com",2196)
        .withSandboxDestination()
        .build();

apnsService.start();

Map<String, Date> inactiveDevices = apnsService.getInactiveDevices();
log.debug inactiveDevices

.....

我们的想法是,变量 inactiveDevices 始终为空!为什么?如果我从设备上卸载该应用程序?!我是否缺少客户端(设备)方面的一些思考?

最佳答案

如果您使用沙盒目标,反馈服务可能不会 正确报告信息。这是一个已知的错误,具有已知的解决方法, 检查mailing list thread

The problem comes from the "Sandbox" APNs Feedback server, probably a bug. Here is the solution if anyone has the same problem:

Create a dummy app id in the program portal, enable development push notifications on it Create and download the associated provisioning profile Create a new xcode project, and invoke the registerForRemoteNotificationTypes method on start. Install the dummy app on your device. At this point, you should have two DEVELOPMENT apps running on your device: the original app and the dummy app. Both should be registered to receive push notifications. Uninstall the original app, and try to send a push notification to that app. Invoke the feedback service, and you should receive data back.

To resume, the Sandbox Feedbacks server needs TWO DEVELOPMENT Apps registered on the SAME iPhone to work. This manipulation is not necessary for the production phase as the "Production" APNs Feedback server works fine.

我建议只切换到生产服务器测试反馈。 请使用生产服务器进行测试或使用解决方法。

关于java - Grails 应用程序,使用 java-apns,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6753608/

相关文章:

css - 如何在 gsp grails 中动态更改左/下人字形

grails - 如何在Grails的一个 View 中将数据插入到四个表中?

java - JScrollPane 的下半部分不出现

java - 由 WebFilter URL 模式引起的 glassfish 部署错误

java - Java 如何处理 alpha channel ?

ios - 基于位置的应用程序,使用带有按钮的滑动汉堡菜单,可过滤 map (iOS MapKit) 搜索结果 Xcode

java - 使用模拟相同静态类的 Power Mock 运行 2 个 Roboelectic 测试类时出现 ClassCastException 异常

iphone - 不同高度的NSCollectionView : How to do this on desktop?

iphone - iCloud 和 GEOResourceManifestServerRemoteProxy : Lost connection to geod warning

html - 您如何在Grails/HTML中设置我的网站的起始部分