LoginSignup
32
37

More than 5 years have passed since last update.

Xcode8(Beta2)とiOS10ではremote push通知用のdeviceTokenが取得できず失敗する時のチェック

Posted at

ちゃんとpush通知用の設定済みでXcode7とiOS9では正常にdeviceTokenが取得できるのに
Xcode8(Beta2)とiOS10ではなぜかdeviceTokenが取れず失敗する。

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error

error => (NSError)Error Domain=NSCocoaErrorDomain Code=3000 "Appの有効な“aps-environment”エンタイトルメント文字列が見つかりません" UserInfo={NSLocalizedDescription=Appの有効な“aps-environment”エンタイトルメント文字列が見つかりません}

このような場合はTarget -> Capabilities -> Push Notificationsを確認してみる
Xcode8(Beta2)ではXcode7ではなかっかStepが追加されている
Add the Push Notifications entitlement to your entitlements file
Fix Issueボタンを押すとprojectname.entitlementsにaps-environmentを追加してくれる

 projectname.entitlements
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>aps-environment</key>
    <string>development</string>
</dict>
</plist>

これで一応開発環境でdeviceTokenが取得できる。

https://developer.apple.com/library/prerelease/content/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/EnablingLocalAndPushNotifications.html
とか見るとaps-environmentの値はdevelopmentとproductionが可能だがXcode8任せではdevelopmentのみ可能な状況

まだBeta2なので何が正解かはわからないが、とりあえず参考までに、、、

ーーーーーーーーーーーーーーーーーーーーー

一応探せたappleからの説明、、もう関係者のメアドとかもないので問い合わせもできず、、
スクリーンショット 2016-07-07 10.44.40.png

32
37
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
32
37