3

For watchOS1 there were several limited, but efficient methods available for sharing data between the watch and the phone - like openParentApp, AppGroups and NSUserDefaults.

With the release of watchOS2 and the WatchConnectivity framework - openParentApp method was deprecated, AppGroups and NSUserDefaults were limited to read-only functionality. Important to note here that WatchConnectivity is supported only by iOS9 devices.

But somehow i see apps on the AppStore claiming to be optimised for watchOS2 while having an iOS8 as deployment target.

Am i missing something? Are there any other methods available for sharing data sufficiently?

4

1 回答 1

2

有些用户可能没有 Apple Watch,他们可能使用 iOS8。为了支持它们,您可以为每个构建目标设置每个部署目标版本。

喜欢项目中的这些示例目标:

  • iOS App(目标:iOS 8.x,您必须将WatchConnectivity框架设置为可选)
  • watchOS 2 应用程序(目标:iOS 9.x 和 watchOS 2)-> iOS8 用户无法安装手表应用程序。
  • watchOS 2 应用扩展(目标:iOS 9.x 和 watchOS 2)

在 iOS 应用程序代码中,您可以WatchConnectivity使用以下代码检查可用性:

NSClassFromString(@"WCSession") != nil;

据我所知,您也可以同时提供watchOS 1 App,但我没有测试过。它不能用模拟器测试,我没有其他有 watchOS1 的苹果手表。

于 2015-10-29T07:16:48.010 回答