Debug on real Apple Watch: Application Verification Failed

倖福魔咒の 提交于 2019-11-27 07:02:47

It turns out you also have to add the UDID of the Apple Watch to the Apple Developer Portal, and update your Development provisioning profile to include this UDID.

The UDID can be obtained in Devices window of Xcode. After pairing, the info of the Apple Watch will automatically display below the info of your iPhone.

At the time of writing, this seems to be documented nowhere, and the error message on the Apple Watch wasn't particularly helpful. So I wish this try-and-error lesson would save you some hassle.

The UDID issue as described above can be the culprit, but in my case, that was handled automatically by Xcode. Looking at the device log (menu Window>Devices) showed:

companionappd[350] : failed to install WatchKit application, error: (Error Domain=LaunchServicesError Code=0 "The operation couldn’t be completed. (LaunchServicesError error 0.)" UserInfo=0x14e2f690 {Error=ApplicationVerificationFailed, ErrorDetail=-402620394, ErrorDescription=Failed to verify code signature of : 0xe8008016 (Entitlements found that are not permitted by provisioning profile)})

... a problem which didn't get caught in the build process, nor was explicitly shared with me in the on-screen errors.

So, I looked at the entitlements:

Yes, I did have to manually add that beta-reports-active in order to submit to TestFlight.

It seems that you needs the flag if you're using TestFlight (and anything other than the default Entitlements), but you need to not have the flag if you're debugging locally.

My solution to this contradiction therefore is to have two entitlements files, like so:

So far, so good. App and Watch Extension are running as expected.

Stefan

Basically you need to perform two steps:

  • Add the UDID of your apple watch to the developer portal
  • Update your provisioning profile to support the watch

XCode can manage the whole process for you:

1. Deploy the App to your iPhone/iPad

2. Start the WatchKit App also on your iPhone/iPad (not in the simulator)

3. Choose Fix Issue, when the code signing error message appears

4. Select your Development Team and let XCode do the rest

I've also written a short tutorial for this.

Don't forget to scroll down in the "Devices" display in Xcode. Xcode -> Window -> Devices ->Select "NameOfiPhone" then in the "Device Information" Window to the right, scroll down. Then you will see the paired device. Yep, I'm admitting this:-)

You should have AppID for each. eg If your app's bundle identifier is "com.xyz" then you need three appids and provisioning profiles called

  1. com.xyz
  2. com.xyz.watchkitapp
  3. com.xyz.watchkitapp.watchkitextension

Create provisioning for each and assign to the related targets.

This will resolve this issue. Make sure your UUID for iphone and watch must be added to these profiles.

Also version for all the targets should be same.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!