watchos-2

Preprocessor macro for Apple Watch?

随声附和 提交于 2020-01-12 13:49:06
问题 I was looking at Apple's Lister (for Apple Watch, iOS, and OS X) sample. The sample performs a test for iOS and OS X: #import <TargetConditionals.h> #if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR) @import ListerKit; #elif TARGET_OS_MAC @import ListerKitOSX; #endif However, there is no test for TARGET_OS_WATCH or similar. Grepping for watch in TargetConditionals.h delivers no hits: $ cat /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer /SDKs/iPhoneOS7.1.sdk

WatchConnectivity how to share session among multiple WKInterfaceControllers?

拥有回忆 提交于 2020-01-06 20:12:48
问题 I have a situation where I need to share WCSession among multiple WKInterfaceControllers. Singleton approach won't work, once you set delegate to a class, all delegates in the other classes are invalidated. Scenario: interface A send and receive data, based on the data content, present interface B. Tap on interface B, will request and receive additional data. How would you share the WCSession between A and B ? 回答1: The other answer doesn't explain that an app-wide session would work. You can

watchOS2 Notification Simulator

落爺英雄遲暮 提交于 2020-01-03 13:03:33
问题 I encountered a strange bug from simulator of watchOS2 on XCode. I handled a notification using UILocalNotification and modified storyboard of static notification. But when I check a value "Wants Sash Blur" and build, It makes an error related with "Carousel.app"(like an unexpectedly stopped.) However, When I turn off that option, it works properly. I don't know why it makes my app break down. Here is an error log Time Awake Since Boot: 1500 seconds System Integrity Protection: enabled

Did Apple change NSUserDefaults sharing from iOS app to watchOS app

旧时模样 提交于 2020-01-03 04:44:08
问题 I want to ask about how to use NSUserDefaults on watchOS app. Is its data different from iOS app's NSUserDefaults 's data? There are a lot of stackoverflow questions about this topic and all of them have same answers. That said, for example Watch apps that shared data with their iOS apps using a shared group container must be redesigned to handle data differently. In watchOS 2, each process must manage its own copy of any shared data in the local container directory. For data that is actually

What is the very reason for WatchKit2 error code 7007 “session on paired device is not reachable”

我的梦境 提交于 2020-01-01 08:06:02
问题 I am developing a glance view for my Apple WatchOS2 app. I'am currently didn't fully understand the prequisites for a stable WatchConnectivity connection now. I have the strange situation, that in the simulator my ComplicationController could successfully a sendMessage Request. When I try to look at my glance, the sendMessage request failed with: Error Domain=WCErrorDomain Code=7007 "WatchConnectivity session on paired device is not reachable." UserInfo={NSLocalizedDescription

Pass text from iOS label to WatchOS label - swift-

倾然丶 夕夏残阳落幕 提交于 2019-12-25 16:44:27
问题 I've a problem, with my app.. I try to follow some guide like Passing data to Apple Watch app , but I'm not sure it will fit for my case. I've some label with text on my iOS app, then I want to show this text on my watchOS app label, and I don't know which is the best way to pass this text and keep it synchronized with the iOS app.. Thanks a lot for your help! 回答1: Since watchOS2, you don't have any built in function for communicating between the iOS and watchOS app than the WatchConnectivity

How can I get workout record from the Activity app in the iphone, does the apple sdk supply this API?

回眸只為那壹抹淺笑 提交于 2019-12-25 11:55:31
问题 I want to get the workout record data from the Activity app in my iphone, does the apple sdk supply this API to access it? Thanks! The detail data I want to access is as below screen: 回答1: You can get access to all of this data using the HealthKit API. I recommend starting with HKHealthStore and the WWDC videos about HealthKit. 来源: https://stackoverflow.com/questions/32859676/how-can-i-get-workout-record-from-the-activity-app-in-the-iphone-does-the-apple

How can I get workout record from the Activity app in the iphone, does the apple sdk supply this API?

半城伤御伤魂 提交于 2019-12-25 11:54:14
问题 I want to get the workout record data from the Activity app in my iphone, does the apple sdk supply this API to access it? Thanks! The detail data I want to access is as below screen: 回答1: You can get access to all of this data using the HealthKit API. I recommend starting with HKHealthStore and the WWDC videos about HealthKit. 来源: https://stackoverflow.com/questions/32859676/how-can-i-get-workout-record-from-the-activity-app-in-the-iphone-does-the-apple

WatchOS 2 not reading NSData from iPhone AppDelegate

南楼画角 提交于 2019-12-25 06:44:45
问题 I need help or an extra eye to find out why my query and methods aren't returning data to the Apple Watch. I am trying to populate my table with images that have PFFiles stored in my parse database. When my messages require a String back, they are going through, but not when I'm requesting NSData back. I am having to ask for an NSData file back because the Watch does not conform to parse protocols, I've learned. So I am trying to convert them on the AppDelegate side, then transfer as NSData.

How to detect which sequence is in page segue for WatchKit?

╄→尐↘猪︶ㄣ 提交于 2019-12-24 18:13:50
问题 I'm trying to implement a page-based navigation app using the "Next Page Relationship Segue" described in this tutorial. In the app, both calendar views show the same type of content. The first one contains today's activities, and swiping presents the second one which contains tomorrow's activities. I'd like to re-use the same code (i.e., same class) for both interface controllers. Then, when each loads, I need to know which one it is, in order to display the activities for today or tomorrow.