0

I am fairly new to Objective-C programming. I have been searching for solutions on how to create remote push notifications (iOS 8) for over a week now, but the only tutorial I could find was this.

I tried reading Apple's 'tutorial' but it was extremely confusing. I followed each of Ray Wenderlich's steps exactly the way he stated them, yet each time I run the 'PushChat' application, I get the following error:

Failed to get token, error: Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application" UserInfo=0x********* {NSLocalizedDescription=no valid 'aps-environment' entitlement string found for application}

I have done countless searches on this error, yet none of the solutions presented fixed my problem. I would greatly appreciate a book/link to a tutorial on how to set up remote push notifications, specifically for iOS 8 and Objective-C due to the fact that their API (from iOS 7 - iOS 8) has so radically changed.

Thank in advance to all who reply. :)


I understand my question has been marked as a 'duplicate'. I can assure you its not. The question I'm being referred to uses a version of Xcode that is over 2 years old. I've attempted the solutions that are provided in the question I'm being directed to, but I still continue to receive the same error message.

iProgramIt
  • 54
  • 1
  • 2
  • 11
  • There is nothing more a new question will do for you as opposed to just reading the many old duplicate questions such as the one above this comment. – Andrew Apr 04 '15 at 02:59
  • I understand what you mean @Santa Claus. I was just hoping that different answers would be provided to my question, seeing as though all the others I've tried haven't worked so far. – iProgramIt Apr 04 '15 at 03:01
  • We cannot give you "different" answers. The simple answer is that the provisioning profile that you are signing your app with does not include the necessary permissions or certificates to support push notifications. You must update your provisioning profile with a development (and optionally production as well) push notification certificates (tutorials can be found elsewhere), and then make sure that you are signing with this profile in your app's `Build Settings` in Xcode. – Andrew Apr 04 '15 at 03:05
  • @Paulw11 I am currently using Xcode 6.2. The question you referred me to is using a version of Xcode over 2 years old. – iProgramIt Apr 04 '15 at 03:05
  • It is probably the same issue though. Nothing has changed in the way that APNS entitlements are set up – Paulw11 Apr 04 '15 at 03:06
  • @Santa Claus Thank you. Can I ask specifically where in the Build Settings tab I would be able to find this signature? – iProgramIt Apr 04 '15 at 03:06
  • @Paulw11 Thank you. I understand what you are saying, but the parameters used within the push notification methods have changed since Xcode 4.3. This is why I asked my question. – iProgramIt Apr 04 '15 at 03:07
  • @iProgramIt No, they really have not changed at all. – Andrew Apr 04 '15 at 03:09
  • 1
    Push notification methods aren't anything to do with the Xcode version, that is the SDK version. There is a slight difference in the way you request permissions but that is about all. – Paulw11 Apr 04 '15 at 03:10
  • You can find the settings within the project settings by clicking on `Build Settings`, then scrolling to the section labelled `Code Signing`. There, you will find options to set your code signing identity and the provisioning profile to use. – Andrew Apr 04 '15 at 03:12
  • @SantaClaus Thank you. That's all I was asking. Also, do you happen to know where else I can refer to on how to set up these remote push notifications? I don't see too many online sources. – iProgramIt Apr 04 '15 at 03:13
  • @iProgramIt Thats quite a broad question...you can use a service such as Parse, which will do the heavy lifting for you and has tutorials for this stuff...but I don't know of a good tutorial for setting up your _own_ service to send these push notifications. – Andrew Apr 04 '15 at 03:17
  • @SantaClaus The solution stated by you and the question didn't work for me the first time, but I am going to try it a second. (In my edited question, I wrote "I've attempted the solutions that are provided in the question I'm being directed to, but I still continue to receive the same error message.") – iProgramIt Apr 04 '15 at 03:23

1 Answers1

0

It sounds like your app doesn't have the push notification entitlement enabled. You need to go back to Certificates, Identifiers and Profiles in the developer portal and edit your app Identifier, making sure to enable Push Notifications by creating developer and production certificates.

Once you've done that you need to regenerate all your provisioning profiles (dev, ad hoc, appstore), download them and open them so Xcode picks them up. At that point, excluding other problems, your push notifications should start working.

Rhythmic Fistman
  • 34,352
  • 5
  • 87
  • 159