Empty project + empty apple watch does not compile in Xcode

Hi,

I have been playing with Apple watch in simulator for a few weeks now and was able to figure out what kind of visuals I want on it. I did all this without any Unity project, just Xcode work.

This week I started looking into using my own project and add the visual design of apple watch I made into it and after 4 days of struggling, I’m no where near compiling it. I’m using Unity 5.

So today I started with making an empty Unity project added a simple text on screen and update it with a number:

private int i = 0;
public Text _label = null;

void Update () {
i++;
PlayerPrefs.SetString (“i”, i.ToString());
_label.text = i.ToString ();
}

this compiles without problem and once I add a watch kit app I get failed build. I browsed around the forum a bit and found some1 with same issue but never answered:

Streamside7, post: 1967049, member: 459811:
Thanks for your reply, however after upgrading to 4.6.2p2, I have created the simplest Unity app imaginable, have switched to the iOS platform, built the app, have opened the project in Xcode and have added the Watchkit target/extension and I receive the following message in Xcode:

error: /Users/rpinglet/Desktop/SimpleApp/Simple/build/Unity-iPhone/Build/Products/ProductName WatchKit Extension.appex: No such file or directory

This should be a very simple thing to do, but it is not. Have you been able to add a Watchkit extension and compile successfully?

Thanks for your help

Any1 has any experience with this on what needs to be done? cause at the moment it seems even google doesn’t know everything these day…

Sorry I don’t have an answer for you but my Unity WatchKit app got a little bit farther.

Basically the appex file not found problem is caused by the Unity xcode project’s build location (with simulator SDK checked) is set to build/Debug-iphonesimulator, but the WatchKit extension’s output location is build/Debug-iphoneos.
I have copied the generated watchkit app and extension files into the Debug-iphonesimulator to fix this copy file error.

After that I encountered another error, the build failed with code signing error
(null): error: Embedded binary is not signed with the same certificate as the parent app. Verify the embedded binary target’s code sign settings match the parent app’s.

I fix this issue by setting the target’s identity/team to the same team for the parent app and the watch kit app targets.
To set the identity team for the parent app is tricky since the General tab is hidden when using Simulator SDK. I have to change the targeted device family to iOS 8 so the General Tab will be visible.

So I got it compiled and built, but I got another error when running on the simulator when the watch app is being installed on the watch simulator. The error message is
SPErrorGizmoInstallNeverFinishedErrorMessage

I am stucked again. I will keep posting my progress, please also share your progressed with me too. Thanks!

The fix is actually quite easy. After you create the Xcode project, add the Watchkit target. Select the Unity-iPhone project in the (Project/Target selection dropdown) Change the Supported Platforms from iPhone to “iOS”.

Hut run and everything just magically works!

alt text

k, I got it to build also, bit different way I think…

I tried adding the team to my parent app, but after lot of cleaning and rebuilding it kept telling me my parent app was not being signed.

Solution for that was to put parent app in correct team, go to Unity, build app again, go to Xcode when done and add new apple watch kit to it and problem was solved

Current error I’m getting now is

Installation Failed
Invalid argument

when I try to run it…

So far my status update, hope to have some better news later

After encountering most of the issues mentioned here and trying lots of the suggestions, I finally got a simulator/watch build running.

The key was to make sure that I changed the ‘Supported Platform’ field on both the Unity-iPhone target and the Watchkit Extension target to ‘iOS’ from ‘iphonesimulator’ - previously I was just setting it for the Unity-iPhone target. Once this was set, I didn’t need to copy any files or change any team or code signing or anything - just one step.

This was with Unity 5.0.1p1 and XCode 6.2.

Hi - just wanted to add that I’ve written a step by step tutorial on integrating the WatchKit api to Unity: http://devgallery.com/unity/watchkit-unity/

Please let me know how you get on!