Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug on real Apple Watch: Application Verification Failed

I tried to debug my WatchKit app on a real Apple Watch today. After hitting the Debug button in Xcode, the main iPhone app was installed properly, but the Apple Watch only displayed the message Failed to install xxx, error: Application Verification Failed. The WatchKit app doesn't install.

I was aware of this: WatchKit App Rejected for "Failing to Install" , but it didn't help because my Xcode project file is alright.

How to make debug work on a real Apple Watch?

like image 804
zavié Avatar asked Apr 24 '15 17:04

zavié


People also ask

How do I debug iOS app on real phone?

Plug your iPhone into your computer. You can select your device from the top of the list. Unlock your device and (⌘R) run the application. You'll see Xcode install the app and then attach the debugger.

How do I test my Apple Watch with Xcode?

As per apple documentation, first build and run your application on iPhone which contains ipa file for both iphone and iwatch as extension and then select watch app target and run from xcode it will launch app on iWatch.

How do I remove Apple watch from Xcode?

In Xcode 6.3. 2, two steps are necessary: Remove the WatchKit extension from "Target Dependencies" Remove WatchKit extension from "Embed App Extensions"


2 Answers

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.

like image 56
zavié Avatar answered Sep 18 '22 20:09

zavié


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:

enter image description here

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:

enter image description here

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

like image 39
SG1 Avatar answered Sep 18 '22 20:09

SG1