标签: apple-push-notifications

苹果推送通知不在生产中

我们完全被困,请帮忙.

我和我的团队制作了一个iPhone应用程序,这是我们第一次尝试使用iOS.

一切都很好,直到我们提交我们的应用程序并在app-store上可用 - 推送通知服务无效.我在网上搜索并尝试通过人们的建议仔细检查我们的应用程序,但我找不到有什么问题.所以这个问题发布在这里.

这些是我们做的:

  1. 我们构建应用程序,假设它名为"AppMaster".

  2. 我们在iOS Provisioning Portal上创建了名为"pushtest"的AppId.此ID在开发和生产上启用了推送通知.

  3. 我们从上面的appId创建了一个名为"AppMasterPushTest"的Provisioning for development.这个配置用于内部测试,团队中的每个人都将其安装在他们的mac上.

  4. 我们的服务器由Java实现,我们使用java-apn包.在测试过程中,我们下载了用于开发的认证文件并写出了.p12文件,并通过使用包的api - withSandboxDestination()和.p12文件将我们的消息推送到"沙盒"服务器.测试顺利,收到通知.

  5. 我认为我们已经准备好了,所以我们创建了另一个名为"AppMaster"的AppId,并仅为生产启用推送通知.此ID写在应用程序的包标识符中.

  6. 我们在步骤5中从AppId进行了另一个名为"appMaster"的生产配置,将分发方法设置为"App Store".下载并重建应用程序.这个被提交给苹果,并在app-stroe上活跃起来.

  7. 服务器端,我们下载了生产认证并再次写出.p12文件.并使程序通过使用api - withProductionDestination()将消息推送到生产服务器,并且.p12刚写出来.

  8. 我们从App Store安装了该应用程序.遗憾的是,通知从未发出.

我们错过了什么吗?顺便说一句,我们在step5中创建的id看起来像"XXX.com.company.appname",但在应用程序的bundle标识符中,我们只设置了"com.company.appname"部分,没有前缀.这可能是问题吗?

欢迎任何想法.

请成为我们的救星.谢谢.

iphone push-notification apple-push-notifications ios

24
推荐指数
1
解决办法
3万
查看次数

Firebase无声apns通知

有没有办法使用google的firebase发送静音APNS?似乎如果应用程序在后台,它将始终向用户显示通知.

谢谢?

push-notification apple-push-notifications firebase silentpush firebase-cloud-messaging

24
推荐指数
5
解决办法
3万
查看次数

如何将推送通知发送到多个设备?

这是我第一次在我的App中使用推送通知.我已经通过示例应用程序和书籍,我得到了如何将推送通知发送到单个设备.但我没有得到我应该在我的程序中做什么更改向多个设备发送推送通知.我正在使用"PushMeBaby"应用程序进行服务器端编码.拜托,帮帮我吧.提前致谢.

iphone push-notification apple-push-notifications

23
推荐指数
1
解决办法
4万
查看次数

无法使用Javapns/Javaapns SSL握手失败发送推送通知

我有推送通知的问题.我有一个由团队成员创建的p.12证书,我有设备令牌,可以将设备推送到.我正在使用javapns库来执行推送(也尝试了相同结果的javaapns lib)但我一直收到此错误:

javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1720)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:954)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1138)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:632)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
at java.io.OutputStream.write(OutputStream.java:58)
at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:402)
at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:350)
at javapns.notification.PushNotificationManager.sendNotification(PushNotificationManager.java:320)
at javapns.Push.sendPayload(Push.java:177)
at javapns.Push.combined(Push.java:100)
at PushTest.push(PushTest.java:43)
at PushTest.main(PushTest.java:25)
Run Code Online (Sandbox Code Playgroud)

这是我用来测试的代码

try {
    List<PushedNotification> n = Push.combined(text, 20, null, file, "********", false, token);

    for (PushedNotification notification : n) {
        if (notification.isSuccessful())  
            System.out.println("Push notification sent successfully to: " + notification.getDevice().getToken());
        else {
            String invalidToken = notification.getDevice().getToken();

            Exception theProblem = notification.getException();
            theProblem.printStackTrace();

            ResponsePacket theErrorResponse = …
Run Code Online (Sandbox Code Playgroud)

java ssl-certificate apple-push-notifications

23
推荐指数
1
解决办法
2万
查看次数

application:didReceiveRemoteNotification:fetchCompletionHandler Not Called

application:didReceiveRemoteNotification:fetchCompletionHandler当应用程序强行退出时,似乎不会调用该函数.我的印象是,无论应用程序处于什么状态,都会调用该函数,但似乎只有在应用程序已在后台运行时才会调用它.有没有办法在后台唤醒应用程序,如果它尚未使用新的iOS 7远程通知后台模式运行?

objective-c apple-push-notifications ios ios7

23
推荐指数
2
解决办法
4万
查看次数

接收重复推送通知ios9

我在iOS9中收到两次相同的推送通知,虽然它在iOS8中工作正常.

我使用以下代码注册推送通知:

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000

if ([application respondsToSelector:@selector(registerUserNotificationSettings:)])
{
    // use registerUserNotificationSettings
    UIUserNotificationSettings *setting = [UIUserNotificationSettings settingsForTypes:( UIUserNotificationTypeSound | UIUserNotificationTypeAlert|UIUserNotificationTypeBadge) categories:nil];
    [[UIApplication sharedApplication] registerUserNotificationSettings:setting];
    [[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
{
    // use registerForRemoteNotifications
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert |UIRemoteNotificationTypeBadge)];
}

#else

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

#endif
Run Code Online (Sandbox Code Playgroud)

iphone objective-c apple-push-notifications ios

23
推荐指数
1
解决办法
1万
查看次数

从一台服务器推送多个应用程序的通知

我正在使用RMSPushNotificationsBundle来处理推送通知.我正在从一台服务器向多个应用程序发送pushNotifications.我正在使用选择正确证书的setAPNSPemAsString方法.但推送通知仅在第一次发送.谁能告诉我为什么?谢谢!

public function sendIOS($appName){
    $notifications = $this->container->get('rms_push_notifications');

    $message = new iOSMessage();
    $message->setMessage($this->message);
    $message->setData($this->getData());
    $message->setAPSSound("default");
    $message->setDeviceIdentifier($this->pushToken);

    if ($appName !="appName") {
        $pemFile    = $this->container->getParameter("rms_push_notifications.ios.".$appName.".pem");
        $passphrase = $this->container->getParameter("rms_push_notifications.ios.".$appName.".passphrase");

            $pemContent = file_get_contents($pemFile);
            $notifications->setAPNSPemAsString($pemContent, $passphrase);
    }
    return $notifications->send($message);
}
Run Code Online (Sandbox Code Playgroud)

php push-notification apple-push-notifications symfony

23
推荐指数
1
解决办法
881
查看次数

如何为ios推送通知提供程序续订SSL证书?

有点不到一年前,一个团队成员现在已经在应用商店中建立了一个iphone应用程序,还有一个ios推送通知守护进程,它发送通知.今天,守护进程开始吐出SSL证书错误 - 似乎守护进程的证书已经过期.

我已经获得了开发者帐户的用户名和密码,并且我已登录到配置门户以创建新证书.如果我去管理我们不再支持的旧应用的应用ID,我会看到:

控制台与配置按钮

但是,如果我管理我正在尝试更新的应用程序ID,我会看到:

控制台没有配置按钮

为什么我没有选择为此应用程序生成新的推送SSL证书?没有它,如何更新推送守护程序的ssl证书?

我们需要重建并重新提交应用吗?

iphone certificate apple-push-notifications

22
推荐指数
1
解决办法
1万
查看次数

APNS推送通知不适用于生产

我创建了一个应用程序来从Web服务器发送远程通知.当我在开发模式下测试应用程序时,所有通知都在手机上正确到达,在AppStore发布后,应用程序不再收到通知.

这就是我做的:

  1. 创建了生产私钥和开发私钥.
  2. 通过传递以前生成的CertFile,在我的App ID上生成两个SSL证书.我100%确定已正确生成2个密钥并正确传递它们以从App中的Dev Center下载SSL证书.
  3. 创建了一个用于开发的文件.pem和一个用于生成的文件(通过转换从我的KeyChain等提取的文件.p12).
  4. 创建了2个不同的配置文件,一个用于开发,另一个用于连接到步骤1的AppID的生产.
  5. 使用在步骤4中创建的正确Provisioning Profiles在Build Settings中签名应用程序.
  6. 创建了一个Web应用程序来捕获和存储用户令牌.
  7. 创建了一个php页面来测试Push Notification Sending.

这是我测试的:

  1. 使用沙盒链接上的telnet测试了开发生成的.pem文件,并获得了成功的答案.
  2. 使用telnet在生产链接上测试生产生成的.pem文件,并获得成功的答案.
  3. 我百分百肯定已经在我的网络应用程序中存储了我的iPhone的开发令牌.
  4. 我百分百肯定已经在我的网络应用服务器上存储了我的iPhone的制作令牌.
  5. 我100%肯定会将我的php页面传递给Apple Server正确的消息(用于开发和生产).
  6. php页面总是返回Apple Server的成功消息(用于开发和生产).

以下是我在Xcode上签署应用的方式:

在此输入图像描述 在此输入图像描述 在此输入图像描述 在此输入图像描述

这是发送通知的php页面的代码:

    $ctx = stream_context_create();

    //stream_context_set_option($ctx, 'ssl', 'passphrase', 'development_pwd');
    //stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck_development.pem');
    //$fp = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx); //test

    stream_context_set_option($ctx, 'ssl', 'passphrase', 'production_pwd');
    stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck_production.pem');
    $fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx); //production

    echo "<p>Connection Open</p>";
    if(!$fp){
        echo "<p>Failed to connect!<br />Error Number: " . $err . " <br />Code: …
Run Code Online (Sandbox Code Playgroud)

xcode push apple-push-notifications ios

22
推荐指数
2
解决办法
2万
查看次数

如何生成有效的APNS证书(.p12)以用于iOS的GCM?

我正在尝试iOS平台的Google Cloud Messaging示例应用.https://developers.google.com/cloud-messaging/ios/start

要生成GoogleServices-Info.plist,需要APNS开发和生产证书(PKCS#12文件格式).我在MAC KeyChain Access中创建了.p12文件(捆绑了APNS开发证书和私钥).

但是在上传.p12文件时,它表示它的格式不正确(证书必须是有效的PKCS12文件).

pkcs#12 apple-push-notifications ios google-cloud-messaging

22
推荐指数
2
解决办法
2万
查看次数