watch-os

Detecting available API iOS vs. watchOS in Swift

空扰寡人 提交于 2019-12-03 09:04:24
问题 #available does not seem to work when differentiating between watchOS and iOS. Here is an example of code shared between iOS & watchOS: lazy var session: WCSession = { let session = WCSession.defaultSession() session.delegate = self return session }() ... if #available(iOS 9.0, *) { guard session.paired else { throw WatchBridgeError.NotPaired } // paired is not available guard session.watchAppInstalled else { throw WatchBridgeError.NoWatchApp } // watchAppInstalled is not available } guard

watchOS - Show realtime departure data on complication

拈花ヽ惹草 提交于 2019-11-30 22:37:49
I have an public transport app with realtime departure data for trains. I would like to add a complication that shows the departure time of the next train. Is it possible to show (or refresh) realtime data on a complication? For example, showing "3 min. to station X." The data could change every minute, based on info that comes from the public transport API. How should I accomplish this on watchOS 2 or watchOS 3? I know the ETA app shows travel times in a complication, but I'm not sure how they achieve that. Are realtime updates possible? Complications aren't designed to show realtime data.

WKURLSessionRefreshBackgroundTask isn't called when attempting to do background refreshes in watchOS

旧巷老猫 提交于 2019-11-30 09:36:55
I'm working on a complication to get scheduled data from a web service. Every 20-30 minutes (or manually), I am scheduling a WKRefreshBackgroundTask to do this. As suggested by Apple, I want the OS to handle the fetching of this data via a background NSURLSession . This is the function I use to download the data I need: func scheduleURLSession() { print("\nScheduling URL Session...") let backgroundSessionConfig:URLSessionConfiguration = URLSessionConfiguration.background(withIdentifier: NSUUID().uuidString) backgroundSessionConfig.sessionSendsLaunchEvents = true let backgroundSession =

WKURLSessionRefreshBackgroundTask isn't called when attempting to do background refreshes in watchOS

你。 提交于 2019-11-29 14:39:39
问题 I'm working on a complication to get scheduled data from a web service. Every 20-30 minutes (or manually), I am scheduling a WKRefreshBackgroundTask to do this. As suggested by Apple, I want the OS to handle the fetching of this data via a background NSURLSession . This is the function I use to download the data I need: func scheduleURLSession() { print("\nScheduling URL Session...") let backgroundSessionConfig:URLSessionConfiguration = URLSessionConfiguration.background(withIdentifier:

Non-Public Library SockPuppetGizmo

时光毁灭记忆、已成空白 提交于 2019-11-28 16:39:01
I got an email that my latest binary submission to Apple for an iOS/Watch OS app was invalid due to: The app links to non-public libraries in PlugIns/iPrayed.appex/iPrayed WatchKit App.app/_WatchKitStub/WK: /System/Library/PrivateFrameworks/SockPuppetGizmo.framework/SockPuppetGizmo I have submitted this build before without any issues, and only made a couple of changes to a few lines of code, without adding anything at all. Any clue what this is about? Seems to be working now. Submission just gives a warning but the binary goes up fine and can be submitted. You have not done anything wrong. I

identifierForVendor or similar for watchOS (2.0+)

笑着哭i 提交于 2019-11-28 10:43:18
问题 Is there any replacement for identifierForVendor on watchOS (2.X)? I have been reading the documentation but it doesn't look like there's any similar method for identifying the device. Thanks! 回答1: You don't need to identify the watch. (hand wave) A user can un-pair and re-pair different watches — say, to switch between a Sport for the gym and an Edition for cocktails — and from the user's point of view when interacting with software, they appear to be the same watch. (The un/re-pairing

Using Core Data with watchOS 2.0

依然范特西╮ 提交于 2019-11-27 21:06:12
I made an iOS/Apple Watch app with WatchKit 1.0 that uses a shared group container and a custom framework to access the same Core Data store. Now, in the transition guide for watchOS 2.0, Apple says this: If your existing Watch app and iOS app use a shared group container or iCloud to exchange data, you must change the way you exchange that data in watchOS 2. Because the WatchKit extension now runs on Apple Watch, the extension must exchange data with the iOS app wirelessly. You can do that using an NSURLSession object or using the Watch Connectivity framework, which supports bidirectional

Watch os 2.0 beta: access heart beat rate

*爱你&永不变心* 提交于 2019-11-27 17:44:25
With Watch OS 2.0 developers are supposed to be allowed to access heart beat sensors.... I would love to play a bit with it and build a simple prototype for an idea I have, but I can't find anywhere info or documentation about this feature. Can anyone point me on how to approach this task? Any link or info would be appreciated Apple isn't technically giving developers access to the heart rate sensors in watchOS 2.0. What they are doing is providing direct access to heart rate data recorded by the sensor in HealthKit. To do this and get data in near-real time, there are two main things you need

Non-Public Library SockPuppetGizmo

早过忘川 提交于 2019-11-27 10:01:47
问题 I got an email that my latest binary submission to Apple for an iOS/Watch OS app was invalid due to: The app links to non-public libraries in PlugIns/iPrayed.appex/iPrayed WatchKit App.app/_WatchKitStub/WK: /System/Library/PrivateFrameworks/SockPuppetGizmo.framework/SockPuppetGizmo I have submitted this build before without any issues, and only made a couple of changes to a few lines of code, without adding anything at all. Any clue what this is about? 回答1: Seems to be working now. Submission

Xcode 7 supporting watch OS1 and OS2

与世无争的帅哥 提交于 2019-11-27 08:18:58
I have been fiddling with Xcode 7 for sometime now, I get to know that it supports only Swift 2 and there is no way to support Swift 1.0 or 1.2 in Xcode 7. This is fine. Now coming to WatchOS, can I have two targets one for WatchOS1 and one for WatchOS2 separately in Xcode 7 so that I can support for both?? I was looking into the deployment target setting in the build settings of both the watch target and the iOS app target but I could see only WatchOS2 in the list so Can I support two targets one for WatchOS1 & WatchOS2 respectively in Xcode 7? If so should I install WatchOS1 SDK at some