0

我在我的应用程序中控制应用程序的推送通知。在 Appdelegate 这是代码

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
     (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];

我收到一个用于生成 PUSH 通知的令牌。我也[[UIApplication sharedApplication] unregisterForRemoteNotifications];用来关闭通知。调用 unregisterForRemoteNotifications 方法是否会使令牌无效,以便我可以从 Apple 反馈服务器获取它,然后避免我的服务器表单向该设备发送 PUSH 通知。我只是想确保我遵循正确的方法。

调用 unregisterForRemoteNotifications 方法后,我没有在手机上收到任何通知,但我也无法使用 JAVA-APNS 代码在反馈服务器中获取令牌

ApnsService service =
APNS.newService()
.withCert("Key.p12", "password")
                .withSandboxDestination()
                .build();


        Map<String, Date> inactiveDevices = service.getInactiveDevices();
        System.out.println("Getting invalid tokens: " + inactiveDevices.size());
        for (String deviceToken : inactiveDevices.keySet()) 
        {
            System.out.println(deviceToken);
        }

我从反馈服务器收到 0 台设备。

4

0 回答 0