Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 7 supporting watch OS1 and OS2

Tags:

I have been fiddling with Xcode 7 for sometime now, I get to know that it supports only Swift 2 and there is no way to support Swift 1.0 or 1.2 in Xcode 7. This is fine.

Now coming to WatchOS, can I have two targets one for WatchOS1 and one for WatchOS2 separately in Xcode 7 so that I can support for both??

I was looking into the deployment target setting in the build settings of both the watch target and the iOS app target but I could see only WatchOS2 in the list so

  1. Can I support two targets one for WatchOS1 & WatchOS2 respectively in Xcode 7? If so should I install WatchOS1 SDK at some place?? or this it totally not possible, if not why?.

  2. If both targets can be supported how can I prevent source duplicates for both targets since both OS have significant differences in terms of architecture.

  3. Also since the introduction of WatchConnectivity framework the iOS counterpart app will also have some changes, how to maintain that for the two targets?

I am confused and I need to take a decision quickly, any help is appreciated.

like image 744
Satheesh Avatar asked Jun 22 '15 07:06

Satheesh


People also ask

What is watch os1?

watchOS is the operating system of the Apple Watch, developed by Apple Inc. It is based on iOS, the operating system used by the iPhone and iPod Touch, and has many similar features. It was released on April 24, 2015, along with the Apple Watch, the only device that runs watchOS.

How do I run Xcode app on Apple Watch?

As per apple documentation, first build and run your application on iPhone which contains ipa file for both iphone and iwatch as extension and then select watch app target and run from xcode it will launch app on iWatch.

Can I pair watchOS 7 with iOS 13?

The pairing process is virtually identical in iOS 13 and WatchOS 6, iOS 14 and WatchOS 7, and iOS 15 and WatchOS 8. You can use the latest WatchOS 8 with Apple Watch Series 3 or later and pair it with an iPhone 6S or later running iOS 15.

What is a WatchKit extension?

WatchKit App. An app bundle that contains your watchOS app's storyboard and any assets used by the storyboard. WatchKit Extension. An extension that contains your watchOS app's code.


Video Answer


1 Answers

You can support watchOS 1 apps in Xcode 7. You can also support watchOS 2 apps in Xcode 7.

If you want to support both watchOS 1 and watchOS 2 then you will need to have separate targets for each OS (due to the differences in architecture)

For a watchOS 1 app, add a new target and select the Apple Watch section from the left and then click on the WatchKit App for watchOS 1 from the list.

watchOS 1 App

For a watchOS 2 app, add a new target and select the watchOS > Application section and then click on the WatchKit App option in the list.

watchOS 2 App

Couple of things to note about making a watchOS 1 app in Xcode 7 (beta 1)...

Because I did my testing on an iPhone 6 running iOS 8.3 and my watch running watchOS 1.0.1, I needed to change my deployment target to iOS 8.3 but note that you want to do this at a project level rather than just target level (so that the extension also gets set to 8.3 and not just the main app) otherwise it won't let you deploy onto a real device.

Due to a known issue in Xcode 7 beta 1, a watchOS 1 app will fail to install on a real watch with the following error if your paired phone is 64 bit:

Jun 20 17:25:08 Liams-iPhone companionappd[271] <Notice>: (Error) WatchKit: validateWatchKitApplicationInfoDictionary, invalid Info.plist key 'UIRequiredDeviceCapabilities'

This is because Xcode 7 is adding arm64 to the UIRequiredDeviceCapabilities info.plist key at build time even to your watchOS 1 extension when it shouldn't be.

You can temporarily get around this by setting Build Active Architecture Only to NO for DEBUG mode.

Xcode 7 Known Issue

Hope that helps

like image 125
liamnichols Avatar answered Sep 21 '22 17:09

liamnichols