Bug 28324 - Watch apps need a _WatchKitStub directory with the WK binary.
Summary: Watch apps need a _WatchKitStub directory with the WK binary.
Alias: None
Product: iOS
Classification: Xamarin
Component: MSBuild ()
Version: XI 8.8.0
Hardware: PC Mac OS
: --- major
Target Milestone: 8.8.x (C4SR4)
Assignee: Jeffrey Stedfast
Depends on:
Reported: 2015-03-23 07:28 UTC by Rolf Bjarne Kvinge [MSFT]
Modified: 2015-04-02 06:14 UTC (History)
10 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Rolf Bjarne Kvinge [MSFT] 2015-03-23 07:28:04 UTC
When Xcode builds a watch app, it adds a _WatchKitStub directory with the WK binary:

> Ditto /Users/rolf/Library/Developer/Xcode/DerivedData/GpsWatch-bfailxurqipkggakjgykbdfnbkue/Build/Products/Debug-iphoneos/GpsWatch\ WatchKit\ App.app/_WatchKitStub/WK /Applications/Xcode62.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.2.sdk/Library/Application\ Support/WatchKit/WK
>    cd /Users/rolf/test/rzaitov/GpsWatch
>    export PATH="/Applications/Xcode62.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode62.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
>    /usr/bin/ditto -rsrc /Applications/Xcode62.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.2.sdk/Library/Application\ Support/WatchKit/WK /Users/rolf/Library/Developer/Xcode/DerivedData/GpsWatch-bfailxurqipkggakjgykbdfnbkue/Build/Products/Debug-iphoneos/GpsWatch\ WatchKit\ App.app/_WatchKitStub/WK

This is required for watch apps to be deployed to watches.

There is a workaround:

1) right-click the watch app project, Add -> New Folder, and write “_WatchKitStub”
2) right-click that folder, Add -> Add Files, and add this file (as a copy):
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/Library/Application Support/WatchKit/WK
( might have to change the path if your Xcode isn’t in /Applications/Xcode.app)
3) right-click that file, Build Action -> Bundle Resource
4) rebuild & redeploy

* Xcode doesn't sign this binary.
Comment 1 Sebastien Pouliot 2015-03-23 08:29:21 UTC
@Paola we'll need to include a test to check for this too
Comment 2 GouriKumari 2015-03-23 10:39:29 UTC
It seems this issue is already reported by Craig and is fixed by Jeff in master : https://bugzilla.xamarin.com/show_bug.cgi?id=27987
Comment 3 Sebastien Pouliot 2015-03-23 10:44:27 UTC
AFAIK that was an _archive_ only fix, not a change to the bundle's content.
Comment 4 Jeffrey Stedfast 2015-03-23 11:56:06 UTC
Sebastien is correct, bug #27987 is just an archive fix and does not change the app bundle produced by the build system.
Comment 5 Sebastien Pouliot 2015-03-23 16:18:57 UTC
@Jeff it looks like this was fixed in master d9cf5affb8d5dc780cfeebf4d2bf2f2f8fdbae83 Anything else missing ? 

If not can you back port it to monotouch-8.8.0-branch so it can be included in SR4 ? thanks!
Comment 6 Sebastien Pouliot 2015-03-23 17:07:20 UTC
monotouch-8.8.0-branch 50919fea300f843701f6eb50b0a62f8c8b978061
macios-cycle5 bf2089caedaf71ced20d1ccda1b57c01d40bc7f2
Comment 7 Saurabh 2015-03-25 02:27:46 UTC
I hav checked this Issue with latest C4SR4 builds and observed that when I Archive main project(WatchKitCatalog project in my case) I am seeing both WatchApp and WK files inside 'com.xamarin.WatchKitCatalog.watchkitextension.appex' . This is the screencast for the same: http://www.screencast.com/t/H427BqncQV

=== Xamarin Studio ===

Version 5.8.2 (build 5)
Installation UUID: 2939b8b4-8977-42bd-82d6-100275ccd9cd
	Mono 3.12.1 ((detached/0849ec7)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312010003

=== Apple Developer Tools ===

Xcode 6.2 (6776)
Build 6C131e

=== Xamarin.iOS ===

Version: (Enterprise Edition)
Hash: 50919fe
Build date: 2015-03-23 17:10:22-0400

=== Xamarin.Android ===

Version: (Enterprise Edition)
Android SDK: /Users/360_macmini/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)

=== Xamarin Android Player ===

Not Installed

=== Xamarin.Mac ===

Version: (Enterprise Edition)

=== Build Information ===

Release ID: 508020005
Git revision: 541c06a4f6c95383333375d56fd6c23ce48cb916
Build date: 2015-03-20 09:23:08-04
Xamarin addins: 02510c4990dee3475c282b3182d588975a63ff07

=== Operating System ===

Mac OS X 10.9.4
Darwin 360-MACMINIs-Mac-mini-2.local 13.3.0 Darwin Kernel Version 13.3.0
    Tue Jun  3 21:27:35 PDT 2014
    root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
Comment 8 Akhilesh kumar 2015-04-01 10:49:46 UTC
we are also able to to build "Archive all" for iOS WatchkitCatalog sample with Cycle5 builds.

Comment 9 Akhilesh kumar 2015-04-01 11:40:26 UTC
Tested with Cycle 5 Builds.

Bug https://bugzilla.xamarin.com/show_bug.cgi?id=28590 is closed with latest Cycle 5 builds in DEBUG mode. 

But in RELEASE mode we are getting inconsistent behavior, some time it build 'Archive All' successfully and some time it gives error.

We are able to to build "Archive all" for iOS WatchkitCatalog sample with Cycle5 builds and I am seeing both WatchApp and WK files inside
'com.xamarin.WatchKitCatalog.watchkitextension.appex' . 
Screencast: http://screencast.com/t/T1OWu2Og

In release mode whenever build 'Archive All' successfully then I am seeing both WatchApp and WK files inside  'com.xamarin.WatchKitCatalog.watchkitextension.appex' .
Screencast: http://screencast.com/t/l0xUqawS9
Comment 10 Akhilesh kumar 2015-04-02 06:14:42 UTC
I have closed this issue Bug 28590 with latest Cycle 5 Builds, https://bugzilla.xamarin.com/show_bug.cgi?id=28590#c8

Now we are able to build "Archive all" for iOS WatchkitCatalog sample with latest Cycle5 builds in DEBUG/RELEASE mode and we are seeing both WatchApp and WK files inside
'com.xamarin.WatchKitCatalog.watchkitextension.appex'  for both debug and release.
Screencast: http://screencast.com/t/t9x7BZD4NR

=== Xamarin Studio ===

Version 5.9 (build 388)
Installation UUID: 91997f85-0008-4b4c-9f53-c7f991fcdae3
    Mono 4.0.0 ((detached/21d849b)
    GTK+ 2.24.23 (Raleigh theme)

    Package version: 400000121

=== Apple Developer Tools ===

Xcode 6.3 (7557.5)
Build 6D554n

=== Xamarin.Mac ===

Version: (Business Edition)

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 4dac6bf
Branch: master
Build date: 2015-04-01 21:55:11-0400

=== Build Information ===

Release ID: 509000388
Git revision: 027c5efa6f92249fd2e614535965159c0a7c0fe6
Build date: 2015-04-01 19:12:53-04
Xamarin addins: a6779639267bbe31df3fd6958be4ecae82665b7e

=== Operating System ===

Mac OS X 10.10.2
Darwin Apples-iMac.local 14.1.0 Darwin Kernel Version 14.1.0
    Mon Dec 22 23:10:38 PST 2014
    root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64