I have an iOS application with several targets, which runs in a really different way on each of them. I added a watchkit app to it, but haven't found a way to specify which target of my app should be the parent. Have any of you found a way? Or is it something to ask Apple about?
You can definitely do this. You can set the target when you create the WatchKit App. Here are the steps:
Set up all your targets in your project (I believe you have this completed)
Select the + under targets and create a new WatchKit App
The next options page let's you pick from a bunch of options to set up the WatchKit App target
Under Embed in Application, choose the target you want to embed the WatchKit App in
I just confirmed this on Xcode 6.2 Beta 5.
Related
While archiving an iOS app on Xcode during the compilation phase;
I get the error -
"error: WatchKit App doesn't contain any WatchKit Extensions. Verify that the value of NSExtensionPointIdentifier in your WatchKit Extension's Info.plist is set to com.apple.watchkit." even though I have confirmed that this is set correct.
Then, why is this happening?
Thanks
Check build settings in watchappextension target if you have correct watch extension Info.plist file path. In my case, i had watch plist set.
I had similar issue. To solve that, I've modified the extension identifier so that it has watchkit's identifier as prefix. This is because, unless identifiers are prefix, those won't be allowed to embed on Xcode settings.
Check list:
In main iOS app settings on general tab, add your watchkit app in the embedded binaries section. Note that, if you ever deleted build folder, the embedded watchkit app may not be displayed in this section even if you just added there.
Make sure you see the watchkit app both in target dependancy & embedded binaries section. If not, add them on the build phases tab of your iOS app.
Now on settings of watchkit app, add your extension in the embedded binaries.
You should see the watchkit extension both in target dependancy & embedded binaries section. If not, add them on the build phases tab of your watchkit app.
On build settings of the extension, make sure bitcode is enabled. Base sdk should be latest iOS sdk.
See the watchkit app identifier is a prefix of the extension. I've renamed the product module (both for watchkit app & extension) to avoid spaces.
You should now be able to build or archive with proper mobile provisions. By the way, my Xcode version is 9.3.
Exit XCode, remove derived data, start XCode again and clean project
Recently I have developed the watch app for my iPhone app and added the watch target in iPhone app.
I want to know is there any kind of setting by which I can choose to add/hide(enable/disable) watch target in iPhone app, like in current market release I don't want to include the watch app, so is there any setting by which I can make it disable in iPhone build but code exist in app.
Is there any kind of target/info plist or build settings by which I can achieve this.
Please suggest.
Any help would be highly appreciated.
Thanks in advance.
Go to your application target, Build Phases, Target Dependencies, and remove the WatchKit Extension from the list.
Check your Build Phases,Copy Bundle Resources in your Target,copy the watchkit app.There need no inclue watchkit app.
We've got an Xcode project with build configurations for the Apple Watch as well. Our Apple Watch app isn't ready yet, so we'd like to release with it disabled. What's the best way to disable Apple Watch functionality in a build?
Remove the WatchKit extension
To make sure that your WatchKit extension is no longer visible, you have to do two things:
1) Remove the WatchKit extension from "Target Dependencies"
(To go to Target Dependencies: in the project navigator, click the project file. Then click the target of the iPhone app. Go to the Build Phases tab.)
2) Remove the WatchKit extension from "Embed App Extensions" (in Xcode 7+, "Embed Watch Content")
(In Build Phases, go to Embed App Extensions. Remove the WatchKit extension entry from the list Embed App Extensions.)
Finally, you may have to clean your build folder. Then build and run your iPhone application.
To re-add the WatchKit extension:
For watchOS1: FIRST, add your WatchKit extension to Target Dependencies. This re-creates the .appex file that you can now add to the list under Embed App Extensions by pressing the plus button and choosing "App Name WatchKit Extension.appex".
For watchOS2: Just add your WatchKit extension to Target Dependencies.
Remarks:
I have tried the whole process of removing and recreating the extension both in the simulator and on the actual devices (iPhone and Apple Watch). It worked in both cases.
I have also tried to do either A or B but that was not sufficient.
I used Xcode version 6.3.2
The above answer is correct but if you are not able to figure out the first point.
1) Remove the WatchKit extension from "Target Dependencies".
It means to go to your target, select build phases, then click Dependencies. remove watch dependency
NOTE
Even better way is to just search 'watch' keyword in Main Target -> Build phases. The dependencies and embed watch content will be listed. Just remove them
I have a watchkit target in my project. The problem I am facing is I don't need the watchkit target to be uploaded right now. I still want to keep the code however and don't want to delete all the files. Is there a way I can submit the App without the watch kit extension App? I thought about deleting the targets (not the files), but I don't know what is the best course of action in this situation. Can I tell itunesconnect not to include the watchkit App?
If you go to the target of your main app and remove the watchkit extension from "Embedded Binaries" it should remove your watchkit app.
To expand upon the answer from Tiago, remove the Watchkit Extension from "Embedded Binaries" and "Target Dependencies."
See Prevent deploying (disable) WatchKit App with iOS iPhone App in Xcode.
I'm trying to run an Apple WatchKit target with my Universal app, using Xcode 6.2
I'm probably doing something wrong, but I can't access to the simulator in the scheme menu
Any idea ?
Have you tried to attach it in the iOS simulator?
This appears to be a bug that at times affects some Build Schemes for some reason. Fortunately, it is easy to fix.
In the menu that appears in your screenshot, select "New Scheme".
Select your WatchKit App as the target, and give it a name. Click 'OK'.
In the new entry in the Schemes menu, you should now be able to open your WatchKit app in the simulator.
You can also correct this issue via "Manage Schemes" and removing and re-adding your existing WatchKit App.
No luck?
For those who are still having a headache after doing this list of things:
Creating new schemes
Hacking Targeted Device Family
Autocreating schemes
Clearing Derived Data and Module Cache cleaning Project
Restarting Xcode, Mac
History
It took me about 3 hours to get rid of no targets (my case was My Mac target), I copied the project somewhere to keep my current data and I did these things to inspect:
Deleting current targets (AppExtension and WatchKit)
Creating them again (for my surprise the iOS Simulator this time came up)
Opening Product->Scheme->Edit Scheme
Selecting a scheme which target is WatchKit App
Under Build I see that my old scheme had only its own target (WatchKit one) while the new that was generated from new targets had 3 targets (MainApp, WatchKit and WatchExtension)
I did the same thing to my old ones by adding target, and the simulator came up, ran it and worked perfectly
Solution
Open Product->Scheme->Edit Scheme
Select your WatchKit Scheme
Select Build and if you see only one target, that could be the case, add the other required target (in my case were MainApp and WatchKit Extension)
If it works, cheers :)
Hope it helps somebody
This is likely the issue reported in the Xcode Release Notes whereby Xcode can't communicate with the simulator service if you rename Xcode.app. Please reboot your system.
Renaming Xcode.app after running any of the Xcode tools in that bundle
may cause iOS Simulator to be no longer be available. Either rename
Xcode.app back to what it was when first launched or restart your Mac.
(16646772)
If you open the Watch Kit project in lower versions of Xcode (6.1 and below) you wont get the simulator options.
Not sure if you have done the same, but I just observed this today.