watchos-2

Check if user has AppleWatch connected without prompting the watch

眉间皱痕 提交于 2021-02-07 20:53:33
问题 We are using Google Analytics , and want to know how many of our users are in possession of an AppleWatch . I have searched Stack for answers, and the recurring answer is to use this: if WCSession.isSupported() { // check if the device support to handle an Apple Watch let session = WCSession.defaultSession() session.delegate = self session.activateSession() // activate the session if session.paired { // Check if the iPhone is paired with the Apple Watch // Do stuff } } The problem with this

Check if user has AppleWatch connected without prompting the watch

廉价感情. 提交于 2021-02-07 20:52:21
问题 We are using Google Analytics , and want to know how many of our users are in possession of an AppleWatch . I have searched Stack for answers, and the recurring answer is to use this: if WCSession.isSupported() { // check if the device support to handle an Apple Watch let session = WCSession.defaultSession() session.delegate = self session.activateSession() // activate the session if session.paired { // Check if the iPhone is paired with the Apple Watch // Do stuff } } The problem with this

Error : Stopped workout session cannot be restarted

倖福魔咒の 提交于 2021-01-28 02:05:35
问题 I can start and stop a HealthKit workout session. But when I try to start a second workout after my first has stopped, I get the error: "workOutSession Error : Stopped workout session cannot be restarted" How do I start the next workout session (after the first has been stopped) without closing down and restarting the app? I am using Xcode 7.2, IOS9.2 and Watch OS 2.1 Stopping from InterfaceController: func startWorkout() { myExtensionConnectivity.startSession() myExtensionHealthKitManager

Apple Watch Complication not updating in background

家住魔仙堡 提交于 2020-12-31 06:42:29
问题 I have an Apple Watch complication that initializes correctly and show the data I am expecting. However, when the NSDate returned in my getNextRequestedUpdateDateWithHandler method triggers a refresh, the only method in my delegate that gets called again is the getNextRequestedUpdateDateWithHandler method (I set breakpoints at every method to determine this). I would have expected requestedUpdateDidBegin to get called when the requested update date occurs, but that doesn't seem to be the case

Apple Watch Complication not updating in background

坚强是说给别人听的谎言 提交于 2020-12-31 06:40:13
问题 I have an Apple Watch complication that initializes correctly and show the data I am expecting. However, when the NSDate returned in my getNextRequestedUpdateDateWithHandler method triggers a refresh, the only method in my delegate that gets called again is the getNextRequestedUpdateDateWithHandler method (I set breakpoints at every method to determine this). I would have expected requestedUpdateDidBegin to get called when the requested update date occurs, but that doesn't seem to be the case

Check how many consecutive days a user has used an app [closed]

一笑奈何 提交于 2020-12-30 04:39:24
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . Improve this question I've already seen other questions asking about how many times the app has been opened. I want to send a local notification when the user uses the app for 31 consecutive days. Would this be a NSUserDefaults discovery method or would I need to use an analytics API?

WatchKit app losing data after going background - Swift

非 Y 不嫁゛ 提交于 2020-02-24 11:32:49
问题 I'm passing a dictionary from my iPhone to the watch using the (watchOS 2) applicationContext method. Inside the iPhone app: func giveMeInfo(){ var lastStringUsed = porkee288.storyPoints.last! do { let resultDict = ["dict": myDict] try WCSession.defaultSession().updateApplicationContext(resultDict) } catch { print("Something wrong happened") } } Inside the watch app: func session(session: WCSession, didReceiveApplicationContext applicationContext: [String : AnyObject]) { dispatch_async

Get Data to Complication: ExtensionDelegate not Called

五迷三道 提交于 2020-01-22 20:18:07
问题 (It looks like this issue has been encountered by others in previous weeks, but there haven't been any solutions that I've found.) I'm trying to do a really basic thing: Get data from either my iOS app or my Watch app to my Complication Controller. I am turning out to be way less capable of getting this done than I thought. watchOS 2 Transition Guide indicates that I should "[fetch] the needed data from the extension delegate" using the following code: ExtensionDelegate* myDelegate = [

iOS/watchos2 - Why doesn't session:didReceiveApplicationContext: fire?

回眸只為那壹抹淺笑 提交于 2020-01-16 05:14:19
问题 I have read the q/a below, and it's great. This is exactly what I'm doing in a test project, and it works fine. I've now created my real project, but in the Watch extension, session: didReceiveApplicationContext: does not fire. Here is my send code: -(void)sendPlistToWatch:(NSMutableDictionary *)dictionary { NSLog(@"%s", __FUNCTION__); if ([WCSession defaultSession]) { NSDictionary *applicationDict = @{@"Favorites.plist":dictionary}; [[WCSession defaultSession] updateApplicationContext

Apple watch and iPhone are not connected when the app in phone goes to background

守給你的承諾、 提交于 2020-01-14 10:12:29
问题 I ran my iPhone app and its watch extension in the simulator. I send messages from phone to watch and vice versa. The messages are sent and received without any issue. But when I send the iPhone app to background, and then a message is sent from watch to iPhone, I continuously get the following log: [WC] __33-[WCXPCManager onqueue_reconnect]_block_invoke error reconnecting to daemon due to NSXPCConnectionInterrupted I searched regarding this but did not find any proper solution. Many have