为临时分发环境启用 Apple 推送通知

发布于 2024-12-01 12:22:33 字数 130 浏览 5 评论 0原文

我已成功实施 APN 开发环境。但我在针对临时分发环境实施相同的操作时遇到了问题。 有人可以建议我是否需要为此创建不同的应用程序 ID、证书和配置文件? Sandbox 有什么变化吗? 步骤教程将非常有用。

谢谢 萨利尔·卡卡尼斯

I have successfully implemented APN for development Environment. But i am facing problems while implementing the same for ad-hoc distribution environment.
Can anybody please suggest me do i need to create different App Id , Certificate and Provisioning Profile for that?
And is there any change in Sandbox?
A tutorial of steps will be very much appriciated.

Thanks
Saleel Karkhanis

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

我的鱼塘能养鲲 2024-12-08 12:22:33

对于 Adhoc 分发,请按照以下说明操作:

  1. 在 Provisioning Portal 中,创建分发证书。
  2. 获取您打算用于测试的 iPhone 的“设备 ID”。打开 iTunes ->连接您的设备 ->选择您的设备->在摘要窗格中,单击序列号标签,它将更改为标识符(40 个十六进制字符)->选择编辑、复制。
  3. 在配置门户中,转到设备 ->添加新设备->输入复制的设备 ID 并为其命名。
  4. 在配置门户中,创建分发配置文件。 (转至配置 -> 分发)。对于分发类型,选中“AdHoc”。选择App Id,如果你有分发证书,这里会自动选择。选择新输入的设备并提交。下载此配置文件。
  5. 在 Xcode 中,窗口 ->组织者。单击设备并选择库 ->配置文件。如果您是管理员,则单击“刷新”应该会获取新创建的配置文件。如果没有,请将临时配置文件拖放到此列表中。
  6. 在 Xcode 中,在您的项目中 Build Settings ->代码签名身份 ->发布部分,选择“iPhone 分发”。对于“任何 iOS SDK”,选择新创建的配置文件。它将出现在列表中。
  7. 在 Xcode 中,产品 ->档案。完成存档后,它将自动打开存档窗口。选择项目并点击Distribute,在Distribute窗口中选择“Save for Enterprise or AdHoc Deployment”->选择与新的配置文件相对应的“代码签名身份”。继续该过程,这将创建一个“.ipa”文件。
  8. 发送此 .ipa 文件和新的配置文件以测试 adHoc 分发。

如何在测试设备上加载 adHoc 发行版:

  1. 打开 iTunes,连接您的测试设备。
  2. 将新的配置文件拖放到 iTunes。
  3. 将 .ipa 文件拖放到 iTunes。
  4. 同步您的设备。这将加载应用程序。

要使推送通知在临时分发上工作:

  1. 使用生产证书。
  2. 使用生产 APN 主机:gateway.push.apple.com
  3. 使用生产 APN 反馈主机:feedback.push.apple.com

For Adhoc distribution, Please follow the instructions below:

  1. In Provisioning Portal, Create a Distribution certificate.
  2. Get the "Device ID" of the iPhone that you intend to use for testing. Open iTunes -> Connect your device -> Select your device -> In Summary Pane, Click on Serial Number label, it will change to identifier (40 Hex characters) -> Choose Edit, Copy.
  3. In Provisioning portal, Go to Devices -> Add new Device -> Enter the copied Device ID and give it a name.
  4. In Provisioning portal, Create a Distribution Provisioning Profile. (Go to Provisioning -> Distribution). For Distibution type , Check "AdHoc". Select the App Id, If you have a distribution certificate, it will automatically be selected here. Select the newly entered device and Submit. Download this Provisioning Profile.
  5. In Xcode, Window -> Organiser. Click on Devices and select Library -> Provisioning Profiles. If you are the admin, then Clicking on Refresh should fetch the newly created provisioning profile. If not, Drag and Drop the Adhoc Provisioning Profile to this list.
  6. In Xcode, in your project Build Settings -> Code Signing Identity -> Release section, Select "iPhone Distribution". For "Any iOS SDK", Select the newly created Provisioning Profile. It will be available in the list.
  7. In Xcode, Product -> Archive. Once it finishes, Archiving, it will open the Archive window automatically. Select the project and click Distribute, In the Distribute window, Select "Save for Enterprise or AdHoc Deployment" -> Select the "Code Signing Identity" which corresponds to the new Provisioning Profile. Continue the process and this will create an ".ipa" file.
  8. Send this .ipa file and the new provisioning profile for testing adHoc distribution.

How to load the adHoc distribution on the test device:

  1. Open iTunes, Connect your test device.
  2. Drag and Drop the new provisioning profile to iTunes.
  3. Drag and Drop the .ipa file iTunes.
  4. Sync ur device. This would load the app.

For Push Notifications to work on Adhoc distribution:

  1. Use the production certificates.
  2. Use production APN Host: gateway.push.apple.com
  3. Use production APN Feedback Host: feedback.push.apple.com.
陈年往事 2024-12-08 12:22:33

我在这方面也遇到了很大的问题。我的代码绝对没有错误。我只是从来没有在 Ad Hoc 的手机上收到过推送通知。

事实证明我的证书有一些问题。我创建了

我不太确定问题是什么,但我通过以团队代理身份登录我的开发者帐户并在该登录名下重新创建所有内容来解决它。我最初是作为团队管理员创建的证书。

您的开发模式可能工作得很好,因为任何团队成员都可以创建开发分发配置文件。但只有某些团队成员可以创建分发配置文件。让您的团队代理创建所有内容并重试。

I had major problems with this as well. I had absolutely no errors in my code. I just never got a push notification on the phone in Ad Hoc.

It turns out that I had some sort of problem with my certificates. I created

I'm not really certain what the problem was, exactly, but I solved it by logging into my developer account as the team agent and recreating everything under that login. I had originally created the certificates as a team admin.

Your development mode may work just fine, since any team member can create development distribution profiles. But only certain team members can create distribution profiles. Have your team agent create everything and try it again.

素年丶 2024-12-08 12:22:33

每个环境(开发和生产)都有一个单独的到推送服务的持久连接。操作系统与沙盒环境建立持久连接以进行开发构建;特别和分发构建连接到生产环境。

如果您使用的是 GCM。转到您的 AppDelegate.swift。查找方法:didRegisterForRemoteNotificationsWithDeviceToken 并替换

registrationOptions = [kGGLInstanceIDRegisterAPNSOption:deviceToken,
                           kGGLInstanceIDAPNSServerTypeSandboxOption:true]

registrationOptions = [kGGLInstanceIDRegisterAPNSOption:deviceToken,
                           kGGLInstanceIDAPNSServerTypeSandboxOption:false

There is a separate persistent connection to the push service for each environment (Development and Production). The operating system establishes a persistent connection to the sandbox environment for development builds; ad hoc and distribution builds connect to the production environment.

If you are using GCM. Go to your AppDelegate.swift. Find method: didRegisterForRemoteNotificationsWithDeviceToken and replace

registrationOptions = [kGGLInstanceIDRegisterAPNSOption:deviceToken,
                           kGGLInstanceIDAPNSServerTypeSandboxOption:true]

with

registrationOptions = [kGGLInstanceIDRegisterAPNSOption:deviceToken,
                           kGGLInstanceIDAPNSServerTypeSandboxOption:false
她说她爱他 2024-12-08 12:22:33

除了苏什玛·萨蒂什的回答之外,
当您将证书从development 更改为distributon 时,为您的手机生成的设备令牌会有所不同。
因此,请确保您正在更改服务器上的设备令牌。

In addition to Sushma Satish's answer ,
When you change certificates from developement to distributon , the device token generated for your phone is different.
So make sure you're changing the device token on the server.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文