ios 如何测试生产推送通知?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12447025/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 20:10:23  来源:igfitidea点击:

How to test production push notifications?

iphoneobjective-ciosapple-push-notifications

提问by Eyal

Until now I used development push certificate and the push notifications worked great.

到目前为止,我使用了开发推送证书,推送通知效果很好。

Now I want to submit my app to Apple so I created a production certificate and set it under "code signing identity" -> "Release"

现在我想将我的应用程序提交给 Apple,因此我创建了一个生产证书并将其设置在“代码签名身份”->“发布”下

I also placed the .p12 file in my production server.
But the push now does not work.

我还在我的生产服务器中放置了 .p12 文件。
但是现在推送不起作用。

Is it suppose to work when I run from xcode? or will it just work when downloading the app from App Store? If so how can I test it?

当我从 xcode 运行时,它是否可以工作?还是只能在从 App Store 下载应用程序时才能使用?如果是这样,我该如何测试?

采纳答案by FrediWeber

The production push will work when you download the app from the App Store.

当您从 App Store 下载应用程序时,生产推送将起作用。

UPDATE:
You can also test the production push with an AdHoc build of the app; see Trinca's answer.

更新:
您还可以使用应用程序的 AdHoc 构建测试生产推送;见特林卡的回答

UPDATE:
Now, the easiest solution is to use Apple's TestFlight. (In TestFlight, it is easy to add new remote users, sending them an email invitation, they then download on whatever device they choose.)

更新:
现在,最简单的解决方案是使用Apple 的 TestFlight。(在 TestFlight 中,很容易添加新的远程用户,向他们发送电子邮件邀请,然后他们在他们选择的任何设备上下载。)

回答by Trinca

You can test APNS production environment building an AdHoc version of your App. The app will be using the production certificates and servers and it's purpose is exactly to test BEFORE you send it to AppleStore.

您可以测试 APNS 生产环境,构建您的 App 的 AdHoc 版本。该应用程序将使用生产证书和服务器,其目的正是在您将其发送到 AppleStore 之前进行测试。

Take a looke at this link: what kind of certificate do I need to test apns using ad-hoc distribution?

看看这个链接:我需要什么样的证书才能使用临时分发测试 apns?

回答by Alex McPherson

Create an Adhoc distribution profile for your app in provisioning profile. Download profile and install. Choose the Adhoc dist profile to code sign your app. Archive ipa and save for adhoc distribution. Copy ipa to your device and test push. It will use production push certs as opposed to development cert. Hope this helps.

在配置文件中为您的应用程序创建临时分发配置文件。下载配置文件并安装。选择 Adhoc dist 配置文件对您的应用程序进行代码签名。存档 ipa 并保存以供临时分发。将 ipa 复制到您的设备并测试推送。它将使用生产推送证书而不是开发证书。希望这可以帮助。

回答by Arun

If you want to test Push Notification on production environment, you need to take care of few things:-

如果您想在生产环境中测试推送通知,您需要注意以下几点:-

  1. Production push notifications can only be tested on ipa. You need to create ipa from AdHoc Distribution profile.
  2. You need to replace the Push certificate on your Push API server. APNS Distributioncertificate is to be used in this case.
  3. If your API is in DOTNET then you need to change the boolean value to true.
  4. Change Code Signing Identity to distribution on both Projectsand Targets
  1. 生产推送通知只能在 ipa 上测试。您需要从 AdHoc Distribution 配置文件创建 ipa。
  2. 您需要替换 Push API 服务器上的 Push 证书。在这种情况下将使用APNS分发证书。
  3. 如果您的 API 在 DOTNET 中,那么您需要将布尔值更改为 true。
  4. 将代码签名标识更改为在项目目标上分发

回答by Peter Lamberg

Testing production notifications (without releasing the build) is possible when the app is installed via Apple TestFlight.

当通过 Apple TestFlight 安装应用程序时,可以测试生产通知(不发布构建)。

This way the production notifications will be delivered to the app.

这样生产通知将被传送到应用程序。

(If the exactly same build is installed via HockeyApp or by other means, the production notifications won't be delivered.)

(如果通过 HockeyApp 或其他方式安装完全相同的版本,则不会发送生产通知。)

Just set the build to internal testing after the build has finished processing in iTunes Connect.

在 iTunes Connect 中构建完成处理后,只需将构建设置为内部测试。