简体   繁体   中英

Apple Watch WCSession return watchAppInstalled false

I have an Apple Watch app and works perfect on simulators (watch simulator and iPhone simulator). When I run the app on real devices, the WCSession watchAppInstalled property is false, but I have the application on a watch, so I can't start it from watch device.

I fixed the issue by uninstalling and reinstalling the watch app. In Watch on the iPhone you select your application and switch the "Show app on Apple Watch" off then on again.

The solution was found here .

Before calling isWatchAppInstalled you must first

  1. Assign a WCSessionDelegate to WCSession.default.delegate
  2. Call WCSession.default.activate()

Otherwise (on WatchOS 5 at least), isWatchAppInstalled will always return false .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM