简体   繁体   English

无法将推送通知发送到iPhone

[英]Unable to send push notification to iPhone

I am sending push-notification to i-phone using Java APNs. 我正在使用Java APN将推送通知发送到i-phone。 Am able to send notification to one app but am not able to send notification to other apps. 能够将通知发送到一个应用程序,但不能将通知发送到其他应用程序。 For first app (Successful sending push notification) am using 对于第一个应用程序(成功发送推送通知),正在使用

String json1= "{\"aps\":{\"alert\":\"Testing.. (3)\",\"badge\":1,\"sound\":\"default\"}}";
PushNotificationPayload payLoad = null;
        try {
            payLoad = PushNotificationPayload.fromJSON(json1);
        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        Push.payload(payLoad , "/home/owner/Downloads/v.p12", null, false, "97884fe9ffeb6f5....");

and for other app (unsuccessful) am using the same 对于其他应用程序(不成功)使用相同的

 String json1= "{\"aps\":{\"alert\":\"Testing.. (3)\",\"badge\":1,\"sound\":\"default\"}}";
    PushNotificationPayload payLoad = null;
            try {
                payLoad = PushNotificationPayload.fromJSON(json1);
            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            Push.payload(payLoad , "/home/owner/Downloads/app.p12", null, false, "191cdc5a8c8c1cb19597a4fd....");

any help ?? 任何帮助?

I found one solution to my problem. 我找到了解决我问题的方法。 am not sure if it is the correct way or not. 我不确定这是否正确。

  1. Create .p12 or .pem using your .cert file from the keychain for app1. 使用来自app1钥匙串中的.cert文件创建.p12或.pem。

  2. clean the keychain store(where all your .cert file exist). 清理钥匙串存储(所有.cert文件都存在的位置)。

  3. download the .cert for app2. 下载app2的.cert。

  4. generate the .p12 or .pem for app2. 为app2生成.p12或.pem。

now I can successfully send notification on both the apps on same device. 现在,我可以在同一设备上的两个应用程序上成功发送通知。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM