Get Device Token in iOS 8

前端 未结 8 2270
借酒劲吻你
借酒劲吻你 2020-12-05 05:12

I need device token to implement push notification in my app.
How can I get device token since didRegisterForRemoteNotificationsWithDeviceToken method is no

8条回答
  •  执笔经年
    2020-12-05 05:52

    Aside from the rest of the condescending answers to this question, the most likely reason that this issue might occur for an informed developer who has implemented all the required delegate methods is that they are using a wild card provisioning profile (why wouldn't you? It makes it so easy to create and test development apps!)

    In this case, you'll probably see the error Error Domain=NSCocoaErrorDomain Code=3000 "no valid 'aps-environment' entitlement string found for application"

    In order to test notifications, you actually have to go back to 2000 and late, log into developer.apple.com, and set up your application-specific provisioning profile with push notifications enabled.

    1. Create an App ID corresponding to your app's bundle identifier. Be sure to check off "push notifications" (currently 2nd option from the bottom).
    2. Create a provisioning profile for that App ID.
    3. Go through the rest of the horrible provisioning steps we'd all love to forget.
    4. ?
    5. Profit!

提交回复
热议问题