Apple Watchkit simulator issue: SPErrorInvalidBund

2019-01-18 18:23发布

问题:

When I open my existing Watchkit app (Xcode 6.2), it compiles correctly, the simulators are launched (iPhone+Watch), followed by the meaningful error:

Error Launching 'xxx Watchkit Extension' SPErrorInValidBundleNoGizmoBinaryMessage

I have this issue with all simulators (iPhone 5/5S/6/6+ - 38mm/42mm)

Any ideas what the issue can be?

It seems for some reason the application does not want to run on the simulator, even though it used to. The iPhone application included in the same project does run, as do other Watchkit sample applications.

回答1:

Did you change the bundle ID of your app? If so you may need to manually update the WKAppBundleIdentifier in the WatchKit Extension and also the WKCompanionAppBundleIdentifier in the WatchKit App.



回答2:

WKAppBundleIdentifier may need to be same to WatchKit App's Bundle Identifier.

Please check WatchKit Extension's info.plist. NSExtension - NSExtensionAttributes - WKAppBundleIdentifier - xxxxx.watchkitapp

EDIT: Further explanation to clarify...

Under your App target you go to INFO tab and set Bundle Identifier to com.myapp

Then under the WatchKit Extension target you go to INFO tab and set the Bundle Identifier to com.myapp.watchkitextension

Then still under the WatchKit Extension target and still under the INFO tab you set NSExtension > NSExtensionAttributes > WKAppBundleIdentifier to com.myapp.watchkitapp

So one ends with .watchkitextension and the other ends with .watchkitapp



回答3:

Check Info.plist for "Your App WatchKit Extension" & "Your App WatchKit App". First part of all indentifiers should be same.

In my case problem was in "Your App WatchKit Extension" > NSExtension > NSExtensionAttributes > WKAppBundleIdentifier.



回答4:

Be sure you are using an 8.3 simulator.

I got this message consistently when using 8.2. Tried everything listed here and struggled with this for hours. Switching to 8.3 resolved it. Ironic, since you must set the deployment target to 8.2 at the moment, but watchkit apps need 8.3 to run I guess...



回答5:

I checked all bundle identifiers multiple times but couldn't get rid of the issue. Neither did cleaning the build folder work out.

However, I was able to sort it out by turning off Game Center at the Capabilities of my WatchKit Extension.

Turning it on for the iOS host app seems to work fine, but turning it on for the WatchKit Extension results in the SPErrorInvalidBundleNoGizmoBinaryMessage error when attempting to run the WatchKit App in the simulator, while it completes building without any complaints.

I'm developing a game for Apple Watch and was looking forward to support Game Center. It was actually my plan from the very beginning to communicate with the hosting iOS app to do so, but then I saw Game Center listed in the Capabilities of the WatchKit Extension itself, so I expected to be able to deal with it right there. However, as it doesn't seem to work, I'm going to stick to my original plan to support it through the hosting iOS app.

Xcode Version 6.2 (6C131e)

EDIT: Same issue with Xcode Version 6.3 (6D570)



回答6:

For issues on real devices (not simulator), do everything in this post: http://blog.jaredsinclair.com/post/117350678170/jareds-code-signing-tips-apple-watch-edition

Most importantly:

All three targets require the following:

a unique app ID for that target a code signing identity (applies to all targets) a unique provisioning profile for that target.

and make sure that the app ID's are consistent:

Your app IDs will look something like this:

com.company.App-Name

com.company.App-Name.todaywidget

com.company.App-Name.watchkitapp

com.company.App-Name.watchkitextension

If it still doesn't work, manually delete the app from the watch (by holding onto the icon and then hit 'x') and then try again. This was the kicker that did it for me.



回答7:

The procedure I solved the problem is

  1. Check if WKAppBundleIdentifier and bundle identifier in WatchKit extension and WatchKit App are correct
  2. Delete subfolders of ~/Library/Developer/CoreSimulator/Devices
  3. Delete subfolders of ~/Library/Developer/Xcode/DerivedData
  4. Clean my project
  5. Restart simulator
  6. Run


回答8:

I've been struggling with this as well. This is what solved my problem on Xcode 7.1 iOS 9. Just Make sure you follow the naming below for your identifiers:

  • Target - com.myCompany.myApp
  • Watchkit app - com.myCompany.myApp.watchkitApp
  • Watchkit extension - com.myCompany.myApp.watchkitApp.watchkitextension

The extension should have the identifier of the WatchKit app target + .watchkitextension



回答9:

I've tried everything posted thus far in this thread but still couldn't get it to work. I resorted to backtrack to the point when it was working and retrace every single action that I've done to figure out at which point it breaks...

As it turned out, the WatchKit App's info.plist file does not like any custom plist entry, at least that is what I've found out in my case. I've added an entry called "MyAppBundlePrefix" and it caused the "Error Launching 'xxx Watchkit Extension' SPErrorInValidBundleNoGizmoBinaryMessage"

I wish XCode would offer a little bit more specific detail for that error but it took me about 5 hours to find it out by brute force way.