苹果推送通知在生产中不工作 [英] apple push notification not working in production

查看:227
本文介绍了苹果推送通知在生产中不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们完全stucked,请帮助。

We are totally stucked, please help.

我和我的团队做了一个iPhone应用程序,这是我们第一次尝试在iOS上。

I and my team made a iPhone application, and this is the first time we try on iOS.

一切都很好,直到我们提交了我们的应用程序和应用程序商店成为可供选择 - 推送通知服务无法正常工作。我在网上搜索周围,试图对人的意见我们的应用程序仔细检查,但我找不到什么是错的。所以这个问题是张贴在这里。

Everything is fine, until we submitted our app and became available on app-store -- the push notification service is not working. I searched around the web and tried double check on our app by people's advices, but I couldn't find what's wrong. so this question is posted here.

这是我们所做的:


  1. 我们构建应用程序,假设它的命名AppMaster。

  1. We build the application, suppose it's named "AppMaster".

我们创建的AppId在iOS Provisioning Portal中呼吁:pushtest。此ID启用了开发和生产的推送通知。

We created AppId on iOS Provisioning Portal called: "pushtest". This ID enabled the Push Notification on both development and production.

我们创建了一个名为发展从上面的appidAppMasterPushTest一个配置。这个配置是内部测试,团队的每个人都安装在他们的Mac上。

We created a Provisioning for development named "AppMasterPushTest" from the appId above. This provisioning is for inside test, everyone of the team installed it on their mac.

我们的服务器由Java实现,并使用了Java的APN包。在测试过程中,我们下载了发展的认证文件,并写出来的.p12文件,并通过使用封装的API推我们的消息,沙盒服务器 - withSandboxDestination()与.p12文件。测试云精细,通知接收。

Our server is implemented by Java and we used the java-apn package. during the test, We downloaded the certification file for development and write out the .p12 file, and pushed our message to the "sandbox" server by using the package's api -- withSandboxDestination() with that .p12 file. test goes fine, notifications are received.

我想我们已经准备好,所以我们创建了另一个名为的AppIdAppMaster,并启用推送通知仅用于生产。此ID是写在应用程序的包标识符。

I thought we were ready, so we created another AppId called "AppMaster", and enable Push Notification only for production. This Id is written in the app's bundle identifier.

我们做了另一个配置从的AppId在步骤5中命名为appMaster产,设置为应用商店的分配方法。下载它,并重建应用程序。这一次被提交给苹果,并在APP-Stroe的去活着。

We made another Provisioning for production named "appMaster" from AppId in step 5, with distribution method set as "App Store". downloaded it and rebuild app. This one was submitted to apple, and goes alive on app-stroe.

服务器端,我们下载了认证,为生产和再次写出来的.p12文件。并提出程序通过使用API​​来推动信息给生产服务器 - withProductionDestination(),与中.P12刚刚写出来

Server side, We downloaded the certification for production and write out the .p12 file again. and made program to push message to production server by using the api -- withProductionDestination(), with the .p12 just been write out.

我们安装了App Store中的应用程序。可悲的是,通知被从未交付。

We installed the app from App Store. sadly, the notification was never delivered.

有什么我们错过了什么?顺便说一句,我们在STEP5创建的ID是看起来像XXX.com.company.appname,但在应用程序的包标识符,我们只是没有设置preFIXcom.company.appname的一部分。是这可能是什么问题?

Is there something we missed? BTW, the id we created in step5 was looks like "XXX.com.company.appname", but in the app's bundle identifier, we just set "com.company.appname" part without prefix. is this could be the problem?

任何想法表示欢迎。

请我们的救星。谢谢。

推荐答案

上面的评论是不正确。该应用程序ID具有preFIX包ID前:

The comment above is incorrect. The app ID has a prefix before the bundle ID :

应用程序ID由具有pfixed应用程序的捆绑ID $ P $的
  由苹果公司产生了10字符code。该小组管理员必须进入
  包ID。对于一个证书,它必须结合特定的捆绑
  ID;你不能用一个通配符应用程序ID。

An application ID consists of an application’s bundle ID prefixed with a ten-character code generated by Apple. The team admin must enter the bundle ID. For a certificate, it must incorporate a specific bundle ID; you cannot use a "wildcard" application ID.

您应该检查你的供应配置文件,以确保它包含正确的APS权利:

You should check your provisioning profile, to make sure it contains the correct aps entitlement :

验证在配置 - 配置文件的权利是
  正确。要做到这一点,打开一个文本编辑器中文件名为.mobileprovision。
  该文件的内容的XML结构。在权利
  字典找到APS-环境的关键。对于发展
  供应轮廓,该键的字符串值应该是
  发展;对于发行配置文件,字符串值
  应生产

Verify that the entitlements in the provisioning-profile file are correct. To do this, open the .mobileprovision file in a text editor. The contents of the file are structured in XML. In the Entitlements dictionary locate the aps-environment key. For a development provisioning profile, the string value of this key should be development; for a distribution provisioning profile, the string value should be production.

您应该确保发送推送通知时到生产服务器APNS(设备令牌,在沙箱环境中工作不生产ENV工作)你正在使用的生产设备令牌。

You should make sure you are using production device tokens when sending push notifications to the production APNS server (device tokens that works in the sandbox environment don't work in the production env).

您应该事先将其释放到应用商店即席供应配置文件测试您的应用程序。在即席轮廓可以与生产环境推

You should have tested your app with an AdHoc provisioning profile prior to releasing it to the app store. The AdHoc profile works with the production push environment.

编辑:

关于设备令牌的一些报价:

Some quotes regarding device tokens :

从<一个href=\"http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingWIthAPS/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW1\">Local和推送通知编程指南:

请留意,在生产环境和设备令牌
  在发展(沙盒)环境中的设备令牌是不一样的
  值。

Take note that the device token in the production environment and the device token in the development (sandbox) environment are not the same value.

注意TN2265 :

处理畸形通知

简单的二进制接口滴,如果推送服务的连接
  收到的通知是在某种方式不正确。你的供应商
  可以响应认为这是一个EPIPE或损坏的管道错误发送
  通知。另一方面,增强的二进制接口将
  发送具有关于什么是更详细的信息的错误响应
  错丢弃连接之前通知。确定
  您的供应商渔获物和妥善处理这些条件。

The simple binary interface drops the connection if the push service receives a notification that is incorrect in some way. Your provider may see this as an EPIPE or broken pipe error in response to sending a notification. On the other hand, the enhanced binary interface will send an error response with more detailed information about what was wrong with the notification before dropping the connection. Be sure your provider catches and handles these conditions properly.

最常见的问题是无效的设备令牌。如果令牌来
  从沙盒环境,比如当你正在测试的
  开发版本的房子,你不能将它发送到生产推
  服务。每推环境会发出了不同的令牌
  同一设备或计算机。如果你做一个器材派令牌错误
  环境中,推送服务将认为这是一个无效的令牌,并
  丢弃通知。

The most common problem is an invalid device token. If the token came from the sandbox environment, such as when you are testing a development build in house, you can't send it to the production push service. Each push environment will issue a different token for the same device or computer. If you do send a device token to the wrong environment, the push service will see that as an invalid token and discard the notification.

最后,这篇文章有多个通知是如何发送到一个很好的解释苹果当一些通知是无效的(最常见的原因是无效的设备令牌),可能会导致某些有效的通知的不同时到达。

Finally, this article has a good explanation of how sending multiple notifications to Apple when some of the notifications are invalid (the most common cause being invalid device tokens), can cause some of the valid notifications not to arrive as well.

这篇关于苹果推送通知在生产中不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆