I'm currently developing an apple watch extension. Anybody knows if the current location is provided by iPhone or Watch itself? I can't find any information about this and i need to draw a compass pointing where the watch is pointing.
相关问题
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
- Get the NSRange for the visible text after scroll
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- Swift - hide pickerView after value selected
- How do you detect key up / key down events from a
- didBeginContact:(SKPhysicsContact *)contact not in
- Attempt to present UIAlertController on View Contr
You can't use CoreLocation from the watchkit extension. You can however use an api to open the parent app (in the background) and ask your parent api for the information. The api is really nice because you can use it with a reply so that you can easily get the information back:
According to Apple's Dev Documentation:
The best solution for performing any long-running tasks is to let your iOS app perform the task instead. For example, instead of starting location services in your WatchKit extension, start it in your iOS app. Your iOS app can gather the needed data and put it in a shared app group so that your extension can access it later. Use the openParentApplication:reply: method to initiate tasks and receive a reply or use a shared group container to communicate details between your iOS app and WatchKit extension. For information about how to handle communication between your iOS app and WatchKit extension, see Communicating Directly with Your Containing iOS App.
P.S. I am working on similar app.
In order to do what you want you don't need CoreLocation you just need a magnetometer.
AFAIK the Apple Watch doesn't have one built in.
The sensors it has are...
No magnetometer though.