在WWDC 2015中,提到手表支持本机应用程序,但我没有看到新Xcode 7中的选项,只是用同伴应用程序构建苹果手表应用程序。如果存在,请告诉我这样做的方法。
答案 0 :(得分:10)
In fact, watchOS apps are linked to the iOS companion app.
In both versions, each watchOS app has two targets: WatchKit App - which contains storyboard, icons, etc - and WatchKit Extension, which contains the code.
In watchOS 1 (old WatchKit) + iOS 8 combination, WatchKit App is installed on Apple Watch, and both WatchKit Extension and iOS app are installed on user's iPhone.
In other way, in watchOS 2 + iOS 9 combination, both WatchKit App and WatchKit Extension are installed on user's Apple Watch, and iOS App is the only code and view installed on iPhone.
Running iOS app only requires one target, so it can run without Apple Watch (since the first iPhone OS).
But running watchOS apps needs both WatchKit App and WatchKit Extension. In watchOS 1 (the old WatchKit) because one is on iPhone and other on Apple Watch, so running apps need connecting between them with Bluetooth, so you have to carry your iPhone nearby. In watchOS 2, both are on Apple Watch, so running apps does not need connecting to iPhone and having iPhone nearby. You can connect them with WatchConnectivity framework included in watchOS 2 SDK (in Xcode 7).
So in watchOS 2 apps can run standalone, but they are not standalone at all. They install on Apple Watch when installing on iPhone, and they can connect with each other. When you create a new watchOS App, you must include it with your iPhone app when submitting it to the iTunes Connect.
NOTE: This makes watchOS apps faster and more reliable.
答案 1 :(得分:5)
您无法构建原生观看应用 。也许在后来的Xcode 7版本中,但到目前为止苹果公司已经宣布“在不久的将来某个时候”你将能够构建一个原生的Watch应用程序。
答案 2 :(得分:4)
在watchOS 2中,WatchKit扩展程序现在在Apple Watch而不是用户的iPhone上运行,因此Watch应用程序是“原生的”。这意味着它无法再使用共享应用程序组与iPhone应用程序共享数据,而必须使用新的Watch Connectivity框架来回传递数据。这也意味着,如果没有手机,手表应用可以更快,更强大。
但是,手表应用程序仍必须与配套的iOS应用程序捆绑在一起,至少在今年是这样。
答案 3 :(得分:0)
在iOS 13中,可以创建独立的watchOS应用程序。可以找到更多信息here。您必须下载Xcode 11才能创建独立的watchOS应用程序。