views:

6711

answers:

7

I have setup push notifications in the apple developer panel and added the code to my application.

It works fine on the phone using a development profile but if I use a distribution (ad-hoc) profile so that I can give it to a few users for testing it gives an error and crashes, the log gives the following error

Code:

Thu Jun 25 22:22:35 unknown SpringBoard[729] <Warning>: *** Assertion failure in -[SBRemoteNotificationServer registerApplication:forEnvironment:withTypes:], /SourceCache/SpringBoard/SpringBoard-919.5/SBRemoteNotificationServer.m:633
Thu Jun 25 22:22:35 unknown SpringBoard[729] <Error>: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'no connection found for environment production'

I am using the following code in the app

Code:

[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];

The thing I don't understand is why it works perfectly using a development profile but with ad-hoc it crashes.

Does anyone know what would cause this?, I've tried changing lots of things to try and find the issue but have found nothing.

+1  A: 

I managed to get this working by re-requesting all of the certificates etc..

Craig
A: 

I am having the same problem but in my case it is a version that was uploaded to the app store! The strange thing is that it started only after the app was approved by apple. I received the 'no connection found for environment production' for the apps downloaded from the app store and a 'no connection found for environment development' for debug version I uploaded from the Xcode. After re-requesting all of the certificates and provisioning files the debug version started working again but the production version still crashes every time a user of mine enters my app. Did you come across new ways of solving this issue?

Roi
This has been happening for me as well although everyone I know can access my app through the app store but me! It must have to do with using the phone for ad-hoc purposes at one point
coneybeare
A: 

I am having the same problem! Does anyone have a way of solving this issue?

+2  A: 

I was having this problem as well. The symptom was the app would crash when calling [[UIApplication sharedApplication] registerForRemoteNotificationTypes:...].

It seems that once a given device loads an APNs Distribution Profile, trying to later go back to using an APNs Development Profile will not work unless you change the App ID.

If you create a user-defined build setting in Xcode, as suggested here:

iPhone "Good Practices"

you can stop the crashing and also have both versions co-exist on the same device for testing, etc.

T. R. Bissonnette
+2  A: 

I solved this problem on one of my development devices by installing a random application from the App Store which uses push notifications. In this case, I installed the Le Monde.fr application. After I ran that application once, my own application no longer crashed.

I couldn't believe that this solution would work, but after I ran out of other ideas eventually I tried it - and it does work! Nice one!
Dan J
A: 

I solved this by going to Settings, then toggling the top "master" Push Notifications switch off, then back on.

Nick Farina
A: 

Lengthy but sure shot solution is to "Erase all Content and Settings".

Ashishail