Why is my Apple Watch Simulator black? - ios

I have a requirement to create a watchkit app.
Please let me know if it is possible to create a separate app with watch kit or do we have to do this with extensions.
I am testing my application in a simulator. The iPhone simulator and the Apple watch simulator both are coming up. The Apple watch simulator is black, no screen is coming up.
My System harddisk : 320 GB , RAM : 5 GB.

If you haven't read this already, have a look at it. In short it looks like you can only achieve this using extensions at the moment.
This article explains what they expect from you as a 3rd party watch app developer.
Apple Watch requires the presence of an iPhone to run third-party apps. To create a third-party app, you need two separate bundles: a WatchKit app (that runs on Apple Watch) and a WatchKit extension (that runs on the user’s iPhone). The WatchKit app contains only the storyboards and resource files associated with your app’s user interface. The WatchKit extension contains the code for managing the WatchKit app’s user interface and for responding to user interactions.
Also
Because a WatchKit app extends the behavior of your existing iOS app, the WatchKit app and WatchKit extension are bundled together and packaged inside your iOS app bundle. During installation of your iOS app, the system prompts the user to install the WatchKit app when a paired Apple Watch is present.

It's not possible to develop standalone WatchKit app. As you said - it has to be an extension. Also your iPhone app has to do something - it can not be just a container for your extension.

Watch Apps have to be set up as App extensions and cannot be created as stand-alone apps. This is just not what Apple has designed the Watch for, rather view it as an additional screen of your iOS device. Apple also recommends to have as much of your ressource-intensive code as possible in the main iOS-App - e.g. background tasks.
As to why your screen is black:
Make sure you are building the Watch App-Scheme. Then even if your Watch app does not have any UI elements yet, you should see the time in the upper right corner of the watch simulator.

Related

How to submit an independant Apple Watch app? [duplicate]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 5 years ago.
Improve this question
I have created an Apple Watch application using XCode 6.3 for iOS SDK 8.3. I tried to upload it to the itunesconnect.apple.com site. I can't find any options to upload Apple Watch apps. There are options only for iOS apps and OS X apps.
Please guide me with this.
2019 Update
As of watchOS 6.0 it is possible to create apps that run on the watch without the need to install a corresponding app on the paired iOS device.
You can follow Apple's instructions to convert an existing watch app into an independent watch app, or just create a new stand-alone watch app in Xcode.
The App Store Connect process is still essentially the same - Create an iOS app. You do not need to provide any iOS app screenshots, only watch screen shots.
Original answer
Apple Watch apps are hosted inside an iOS app, as an iOS extension - so to submit an Apple Watch app you need to submit an iOS app.
From the Apple Watch Programming Guide
Apple Watch requires the presence of an iPhone to run third-party
apps. To create a third-party app, you need two separate bundles: a
WatchKit app (that runs on Apple Watch) and a WatchKit extension (that
runs on the user’s iPhone). The WatchKit app contains only the
storyboards and resource files associated with your app’s user
interface. The WatchKit extension contains the code for managing the
WatchKit app’s user interface and for responding to user interactions.
Because a WatchKit app extends the behavior of your existing iOS app, the WatchKit app and WatchKit extension are bundled together and packaged inside your iOS app bundle. During installation of your iOS app, the system prompts the user to install the WatchKit app when a paired Apple Watch is present.
When you submit your hosting iOS app to App Store you have an option to provide Apple Watch application screen shots to go along with your main app screenshots.

Can an iOS app be added later to an Apple Watch only app?

Beginning with WatchOS 6 Apple makes it possible to ship Watch-only apps. While we can first ship an iOS app and later add a companion app for the Apple Watch, I'm wondering if the reverse is possible as well:
Can we ship an Apple Watch-only app, which is installed via WatchOS App Store directly on the watch and then later add an iOS app to it?
This is important to me as I don't want to put a barrier on front of this option. You may still find out after publishing your watch app that it will profit from having a companion app on the iPhone. Or you might find that your watch app will gain more publicity when its iOS companion app becomes visible in the iOS App Store as well.
Yes, this is simply a matter of going to the project at the top level of the project navigator, then adding a new iOS target to your Apple Watch project.

Implications of converting dependent watchOS app to independent with watchOS 6

I am considering updating to an independent app for watchOS 6 (as Apple suggests) but it's not clear to me what will happen to users of older watchOS versions that have my app installed. More specifically:
What will happen if a user had the dependent app installed on their watchOS 5 watch but downloads an update of the iOS app (which now lists the watch app as independent) for their connected iOS 13 iPhone? Will the watch app be uninstalled or not function at all (since it will try watch connectivity with an iOS app that no longer supports it)?
This will definitely occur, since, according to official page:
watchOS 6 will be available for Apple Watch Series 1 and Apple Watch Series 2 later this fall.
I think this is not a hard question. An independent app means that the app can work alone. But it doesn't have to. An independent watchOS app should work with or without the iOS companion app. If you watchOS app can't work properly without iOS companion app, it is not an independent app. You should refactor your Apple Watch Extension or just leave it as not independent.
Here are what I believe should be true:
If you installed an Apple Watch app with its iOS companion app, both apps are removed if you remove the iOS app.
However, if the Apple Watch app is independent, you could installed it alone without install the iOS companion app.
For the second rule, there are some pitfalls as a developer. When you are debugging an independent watch app, it is listed in Watch app on iPhone. However, since there is no iOS companion app, you can't remove it entirely on iOS. Even if you have removed it on Apple Watch, it is still shown as not installed in Watch app.

WatchKit native applications

Is it possible to create native WatchKit applications, which would be able to run without an extension running on a paired iPhone ?
Not at the moment:
Apple Watch requires the presence of an iPhone to run third-party apps. To create a third-party app, you need two separate bundles: a WatchKit app (that runs on Apple Watch) and a WatchKit extension (that runs on the user’s iPhone). The WatchKit app contains only the storyboards and resource files associated with your app’s user interface. The WatchKit extension contains the code for managing the WatchKit app’s user interface and for responding to user interactions.
But it will come soon :
The iOS 8.2 SDK beta including WatchKit is available immediately for iOS Developer Program members at developer.apple.com/watchkit. The WatchKit site includes programming guides, human interface guidelines, templates and more. Starting later next year (meaning 2015), developers will be able to create fully native apps for Apple Watch.

How to establish a communication channel between Apple Watch Extension/App and iOS App

I'm exploring the WatchKit SDK.
When I have a WatchKit app, is it possible to set values (e.g. Text, settings) from the iPhone app on the WatchKit app? Can I call functions in the WatchKit app extension from the iPhone app?
If someone managed to do this, could he/she post an example? Thanks!
You can use App Group and sharedDefaults to share data between the WatchApp/Extension and the App on the phone.
see example:
WatchKit SDK not retrieving data from NSUserDefaults
Study up on iOS8 Extension/App Groups/sharedDefaults and watchkit extension will make more sense.
This sample takes a UIImage from Shinobi chart, save it to defaults as image.
Then extension picks up the image through defaults and shows it on watch
https://github.com/ChrisGrant/ChartWatch
This one uses multipeer connectivity to have watch talk to phone.
https://github.com/jsclayton/swatches
but this uses Bluetooth and I presume the Watch OS also communicates to the phone using bluetooth so not sure if they'll both be allowed.
We have no devices to test on yet so the /swatches app is just watch simuator talking to iphone simulator on same mac.
If youve ever done low level AV programming you know the app may run on the simulator but fail on the device because the simulator can cheat an use Mac OSX media layer. May be the same for bluetooth.
other samples
https://github.com/search?q=WKInterfaceController&type=Code
There are several solutions: CoreData, NSKeyedUnarchiver and NSUserDefaults. With a common background for sharing the common data resource (Database, file or user default settings), this is enabling App Groups capabilities on both targets project properties.
In the following post is explained how to do it with default settings and you can also download the demo project.
With watchOS2 now Apple supports Watch Connectivity Framework to pass information from watch extension to app and vice versa.
Taken from Apple's docs
Communicating with Your Companion iOS App
The Watch Connectivity framework lets you create a bidirectional communications channel between your WatchKit extension and your companion iOS app. Use this channel to coordinate activities between the two processes. For example, you might use this framework to push updated information from your iOS app to your WatchKit extension. The framework provides options for transferring data in the background or while both apps are active and replaces the existing openParentApplication:reply: method of the WKInterfaceController class.
For more information the classes of the Watch Connectivity framework, see Watch Connectivity Framework Reference.
Taken from Apple's Developers Library
You can see this library
https://github.com/mutualmobile/MMWormhole
It do Message passing between iOS apps and extensions.
looks like the links with brain.clear are not pointing to the right destination for ShinobiChart example
https://github.com/ShinobiControls/ChartWatch

Resources