31

I've been reading a bunch of Apple's docs, as well as many other SO questions, but haven't found the answer to this particular question.

I have an existing workflow in place for generating AdHoc Distribution builds for QA members and beta testers. Now that I've added support for push notifications, I'd like those notification paths to be able to be tested as well.

I'm under the impression that Developer builds, signed with a Development provisioning profile, generate tokens that for the sandbox/development APNS environment, and Distribution builds, signed with a Distribution provisioning profile (whether that be destined for AdHoc Distribution OR AppStore Distribution), generate tokens for the production APNS environment. I believe this can be confirmed by opening the different .mobileprovision files, and examining the aps-environment key.

I'd like to know if there's a way to have my AdHoc Distribution builds use the sandbox APNS environment, rather than the production APNS environment.

If I really wanted QA and beta testers to use sandbox APNS, would I have to somehow find a way to allow them to run development builds, rather than distribution builds?

Or are my assumptions about the way things work way off base? (referenced this post and this post)

Community
  • 1
  • 1
beno
  • 2,160
  • 1
  • 25
  • 24
  • More of an inside-baseball reason to my organization... there's an API layer that abstracts away some of the notification responsibilities, among many other services, and it has 2 "modes" (staging/production), so it made sense at the time to associate the our internal "staging" API with the sandbox APNS environment, but that may have been an unnecessary distinction to make. – beno Mar 06 '13 at 15:08

2 Answers2

46

I did found some mention to AdHoc in the context of APNS environments :

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

It's taken from Technical Note TN2265. I guess this note confirms that you can't use the sandbox env in AdHoc distribution.

Eran
  • 387,369
  • 54
  • 702
  • 768
  • nice find, I hadn't seen that explicitly stated anywhere. – beno Mar 06 '13 at 16:19
  • also found this answer: http://stackoverflow.com/questions/2625773/why-not-use-development-provisioning-instead-of-ad-hoc – beno Mar 06 '13 at 18:02
  • Thats right. For GCM just go to your AppDelegate.swift, find method didRegisterForRemoteNotificationsWithDeviceToken and replace kGGLInstanceIDAPNSServerTypeSandboxOption:true with kGGLInstanceIDAPNSServerTypeSandboxOption:false. After that you are not in sandbox environment anymore. – stakahop May 31 '16 at 09:51
  • If TestFlight builds are just on-demand ad hoc, then this paragraph means that TF builds can't use the sandbox APNS either (via https://stackoverflow.com/q/44399563/22147) – Rhythmic Fistman Jun 09 '17 at 00:29
  • @stakahop I *think* your answer is very specific to Google Cloud Messaging... I cant see how to apply that to a normal Apply Push setup? – Nick Nov 21 '17 at 15:53
  • Ah that’s a shame, would be nice to update this question for 2017/18 – Rhythmic Fistman Nov 21 '17 at 20:11
6

Apple uses a different server for:

  1. Apps signed with a Development profile
  2. All other profiles (AdHoc, InHouse and AppStore). These are going via a Live Server.
Nathan S.
  • 5,244
  • 3
  • 45
  • 55
thatzprem
  • 4,697
  • 1
  • 33
  • 41