ios - 使用 openParentApplication : and handleWatchKitExtensionRequest: to send location updates to Watch App not working

标签 ios objective-c xcode watchkit apple-watch

我正在使用 openParentApplication:handleWatchKitExtensionRequest:请求并发送一个 NSNumber 对象,该对象包含来自核心位置 locationManager:didUpdateLocation: 的值方法。我这样做是为了让我的 watchkit 应用程序不必担心使用 Core Location,并且我可以使用我已经在 iOS 应用程序中编写的所有逻辑。对我的 watchkit 扩展的回调似乎工作正常,我在“回复:”回调中得到了回复。

但是,在我手动点击模拟器中的应用程序图标之前,我从未从核心位置获得任何真实数据。然后我开始从核心位置获取真实数据,并且我的 watch 套件界面更新为正确的数据。

这只是模拟器的限制吗?

最佳答案

我需要使用 requestAlwaysAuthorization而不是 requestWhenInUseAuthorization .这样做让我能够以我想要的方式获得位置更新。

关于ios - 使用 openParentApplication : and handleWatchKitExtensionRequest: to send location updates to Watch App not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29380718/

相关文章:

ios - NSOperation 依赖操作和依赖对象

ios - iOS的钥匙串(keychain)服务,删除钥匙串(keychain)错误

swift - Swift 子句中的 NOT 运算符问题

ios - 将数据从 ViewController 传递到 Viewcontroller,该 Viewcontroller 现在是 TabBarController 的一部分

xcode - Xcode 10 中的多光标编辑

ios - 调整图像大小但从未恢复到原始大小

ios - UIScrollView 在 applicationDidBecomeActive 后关闭

ios - 如何将对象添加到从 Storyboard 扩展到 UIView 之外的 UIScrollView?

objective-c - Cocoa webview : Slow on first execution of app, 然后就好了

ios - MKMapView 不填充 View (iOS)