iPhone:生产证书的推送通知测试

发布于 2024-11-16 07:25:52 字数 164 浏览 6 评论 0原文

我有一个简单的问题。我一直在测试我的 iPhone 应用程序的开发推送通知证书,并且运行良好。我只是想知道在向 AppStore 提交申请之前是否可以测试生产证书?我确实尝试过,但当我使用生产证书时没有出现消息。使用生产证书时,Apple 是否要求应​​用程序必须在 AppStore 中?

谢谢。

I have a quick question. I have been testing Development Push Notification Certificate for my iPhone App and its been working fine. I just want to know that is it possible to test Production Certificate before submitting my application to AppStore? I did try but message is not coming along when I use production certificate. Does Apple required application to be in AppStore when I use production certificate?

Thanks.

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

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

发布评论

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

评论(3

離人涙 2024-11-23 07:25:52

如果您创建临时配置文件,您会发现它使用生产证书,这可能是测试它的最简单方法。

更新:

请参阅Apple 文档< /a>

这有很多步骤,但本质上是;

1) 团队负责人需要创建一个新的 DISTRIBUTION 配置文件。这是通过在创建新配置文件时选择“Ad Hoc”而不是“App Store”来完成的。顺便请注意,您不能为此使用通配符应用程序 ID,您需要为该应用程序提供一个特定的应用程序 ID,尽管您可能已经拥有该应用程序 ID。

2) 设置您的系统,以便存档构建使用新创建的临时配置,设置所需的步骤在网上有详细记录,这是一个示例

3) 现在,当您将 .ipa 分发到链接到 Ad Hoc 配置文件的设备时,您会发现推送通知系统正在使用生产服务器。

顺便说一句,我发现 testflightapp 对于管理 Ad Hoc 构建的分发非常有用,尽管我最近才发现它,但它目前为我节省了时间,因为我正在运行 beta 测试程序。

If you create an Ad-Hoc Profile, you'll find that it uses the production certificate, that's possibly the easiest way of testing it out.

UPDATE:

See the Apple documentation here

There are a number of steps to this but in essence;

1) The team leader needs to create a new DISTRIBUTION provisioning profile. This is done by selecting "Ad Hoc" rather than "App Store" when creating a new profile. Note by the way that you can't use a wildcard app id for this, you need to have a specific app id for the application although you may well have this already.

2) Setup your system so that build for archive uses a newly created Ad Hoc configuration, the steps required for setting this up are well documented online, here is one example.

3) Now when you distribute the .ipa to devices linked to your Ad Hoc provisioning profile, you will find that the push notification system is using the production servers.

As an aside, I find that testflightapp is really useful for managing the distribution of Ad Hoc builds and although I've only discovered it recently, it's saving me hours at the moment as I'm in the middle of running a beta test programme.

单身情人 2024-11-23 07:25:52

对于 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。

在测试开发环境的推送通知时,应牢记一些严格的清单。其中大部分已经在上面提到过。但这是解决我问题的一件事,我想分享。我希望它能帮助某人。那就是:

请注意设备令牌 ID,它对于开发者来说是不同的。生产环境。

- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
       NSString *deviceTokenStr = [[[[deviceToken description]
                                      stringByReplacingOccurrencesOfString: @"<" withString: @""]
                                     stringByReplacingOccurrencesOfString: @">" withString: @""]
                                    stringByReplacingOccurrencesOfString: @" " withString: @""];
       UIAlertView *alert= [[UIAlertView alloc]initWithTitle:deviceTokenStr message:Nil delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
        [alert show];
}

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.

There are severeral checklist that one should keep in mind while testing pushnotification for development environment. Most of them are already mentioned above. But this is one thing THAT SOLVED MY PROBLEM and i would like to share. I hope it helps someone. And that is:

Please be aware of the device token-ID, which is different for the development && Production environment .

- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
       NSString *deviceTokenStr = [[[[deviceToken description]
                                      stringByReplacingOccurrencesOfString: @"<" withString: @""]
                                     stringByReplacingOccurrencesOfString: @">" withString: @""]
                                    stringByReplacingOccurrencesOfString: @" " withString: @""];
       UIAlertView *alert= [[UIAlertView alloc]initWithTitle:deviceTokenStr message:Nil delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
        [alert show];
}
旧城烟雨 2024-11-23 07:25:52

如果您想节省更多时间,可以

在生产环境中debug1测试这些通知,而无需构建和构建通知。每次分发时,请按照以下步骤操作:

  1. 创建并创建安装您的分发配置文件,
  2. 使用发布配置而不是调试创建一个新方案(有关说明,请参阅帖子的第二部分)并选择它,
  3. 确保您在应用程序的目标构建设置下为发布配置选择了分发配置文件,
  4. 摇滚!

如何创建新方案

  1. 单击左上角的应用程序名称:

    在此处输入图像描述

  2. 选择“新方案...”并为其命名,

  3. 然后,通过打开它来编辑它再次菜单并选择“编辑方案...”,
  4. 在“构建配置”下选择“发布”:

    在此处输入图像描述

  5. 选择它,使其出现在左上角,就完成了!

1 :您不能使用发行版或临时配置来调试,请参阅此线程

Alternative

If you will to save even more time, and debug1 test these notifications in a production environment, without having to build & distribute each time, follow these steps :

  1. Create & install your Distribution provisioning profile,
  2. Create a new scheme using the Release configuration instead of Debug (see the 2nd part of the post for instructions) and select it,
  3. Make sure you have your distribution profile selected for the release configuration under your app's target build settings,
  4. Rock'n'roll!

How to create a new scheme

  1. Click on your app's name, on the left corner :

    enter image description here

  2. Select "New scheme..." and give it a name,

  3. Then, edit it by opening this menu again and select "Edit scheme...",
  4. Select "Release" under "Build configuration" :

    enter image description here

  5. Select it, so it appear on the upper left corner, and you're done!

1 : you can't use the distribution nor the ad-hoc provisioning to debug, see this thread

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