3

I am writing a Watch App for one of my applications. Since my team don't have an Apple Watch yet, I build a Simulator version of my application as well on my build server for my QA team and they are using "xcrun simctl" to run and test the watch app itself.

Everything went well until Xcode 6.3 came. With Xcode 6.3 I received this error when I've tried to build the app locally on my development machine :

error: The value of CFBundleVersion in your WatchKit app's Info.plist (1) does not match the value in your companion app's Info.plist (2.0.492). These values are required to match.

To fix this issue, I've modified my info.plist files to contain the same CFBundleVersion. This modification fixed the build issue on my local development machine, but : QA is still able to run the iOS application, but launching the Watch App fails with this error :

> xcrun simctl launch 0D5238ED-CBE9-4DCC-961D-BC756E0885CD com.company.enterprise.appname.watchapp
An error was encountered processing the command (code=4):
The operation couldn’t be completed. (FBSOpenApplicationErrorDomain error 4.)

I can't see anything in the system console log which could be related to this. :/

Do you know any ideai how could this issue be solved?

Thanks in advance for any help!

Jay Mehta
  • 1,431
  • 19
  • 40
thorax
  • 574
  • 1
  • 5
  • 16
  • please check this answer http://stackoverflow.com/a/25968057/2497120 – Musadhikh Muhammed K Apr 17 '15 at 09:27
  • Thanks. Unfortunately I already saw that but none of the listed solutions helped. – thorax Apr 17 '15 at 09:40
  • Hm... I have to report this to Apple : It seems that : 1. to be able to run the watch app using the simulator build, the version number in Info.plist for the watch app have to stay “1”, and “1.0” for the WatchKit Extension. 2. to be able to build locally, the version number must be the same as the companion iOS app. – thorax Apr 17 '15 at 10:52

3 Answers3

2

I'm running into this as well.

Basically, you should have 3 targets (4 if you count Tests). If you check the build phases, you will see that the WatchKit App must compile first, followed by the WatchKit Extension, and finally the main app.

I have a script that I've used for ages that automatically updates the CFBundleVersion each time the app is compiled.

There is a place to "Run Script" in the Build Phases for the Extension and for the main app, but not the WatchKit app.

So, the first thing that gets compiled is the WatchKit app, then that is moved to the build directory. It will have whatever number was in CFBundleVersion that was as last entered manually.

The second thing that gets run is the Extension compilation. Here is where my script runs and updates the number. However, the number is now one more than the number in the WatchKit app, which has already been moved to the build directory. So, even though they started life as the same number (say 1), by the time the extension gets moved over, it's now at 2 and there is a mismatch.

There is no way to update the WatchKit App CFBundleVersion in an automated fashion by using a Run Script.

Personally, the way I'm going to solve it is to set the CFBundleVersion manually in my WatchKit App when I want it to change, then I'm going to have Run Scripts in the build phases for the other two targets to copy the CFBundleVersion from WatchKit App into their respective CFBundleVersions to keep them all in sync.

Long story short, you have three CFBundleVersions to keep track of and make sure they are all the same number.

Mark Travis
  • 687
  • 6
  • 5
0

In order for Watch apps to function properly, certain properties must match across the Watch app and its App Extension (18857540):

  • The WKAppBundleIdentifier property of NSExtensionAttributes in the WatchKit App Extension’s Info.plist must match the CFBundleIdentifier of WatchKit App's Info.plist.
  • The WKCompanionAppBundleIdentifier property of the WatchKit App's Info.plist must match the CFBundleIdentifier of the Containing iOS App's Info.plist.
Fabio Poloni
  • 8,219
  • 5
  • 44
  • 74
ares777
  • 3,590
  • 1
  • 22
  • 23
  • Thanks for your answer. I have checked this as well before. Both of these are true for my project. – thorax Apr 17 '15 at 11:59
0

I turned out that adding CFBundleGetInfoString to the watchKit Extension/watchKitApp caused the issue for me (it is OK to have it in the companion iOS app itself). Removing that solved the issue for me.

defaults delete `pwd`/myApp WatchKit Extension/Info CFBundleGetInfoString
defaults delete `pwd`/myApp WatchKit App/Info CFBundleGetInfoString
thorax
  • 574
  • 1
  • 5
  • 16