watchkit

FBSOpenApplicationErrorDomain Code=3

淺唱寂寞╮ 提交于 2019-11-27 03:01:29
问题 I just added a Watch app to my project and try : override func awakeWithContext(context: AnyObject?) { super.awakeWithContext(context) let res = WKInterfaceController.openParentApplication(["key" : "value"]) { (replyInfo, error) -> Void in print("replyInfo : \(replyInfo) + error \(error)") } print(res) // true here } In my AppDelegate I wrote : func application(application: UIApplication, handleWatchKitExtensionRequest userInfo: [NSObject : AnyObject]?, reply: ([NSObject : AnyObject]?) ->

Is there any way to access the accelerometer from the Apple Watch?

可紊 提交于 2019-11-27 02:37:06
问题 It doesn't look like WatchKit released today has such API included. 回答1: No. Direct access to the Apple Watch sensors (which include the accelerometer) is not possible. As always, if this is something you'd like, please file a request for it at https://bugreport.apple.com. 回答2: Sensor Data information is now available in Watchkit for watchOS 2.0 . You could check this information in the following session which is total 30 minutes presentation.If you do not want to watch entire session, then

How to calculate current location in WatchKit extension

随声附和 提交于 2019-11-27 02:23:34
问题 How to calculate the current user location in Watch Kit extension as we can't use CoreLocation in watch kit. Thanks in advance 回答1: You can use CoreLocation in your watch app extension very similarly to how you use it in your iPhone app. The key difference is that a user can't authorize your extension to have access to Core Location. They will need to do that from your iPhone app. So you will need to check if the user has authorized location services for your app and if they haven't, you will

Watchkit , openParentApplication with WatchKit Extension

风格不统一 提交于 2019-11-27 02:18:55
First times doesn't work "Null" ( before open App in iPhone ) and some times doesn't work but i want one loop or timer for repeat this request for get result : here is my code - (void)application:(UIApplication *)application handleWatchKitExtensionRequest:(NSDictionary *)userInfo reply:(void (^)(NSDictionary *))reply { // Temporary fix, I hope. // -------------------- __block UIBackgroundTaskIdentifier bogusWorkaroundTask; bogusWorkaroundTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{ [[UIApplication sharedApplication] endBackgroundTask:bogusWorkaroundTask

Passing data to Apple Watch app

血红的双手。 提交于 2019-11-27 01:02:50
I am trying to pass data from my app into my Apple Watch app. Basically, I am using the same method as I used for creating the today widget and so I am passing data through NSUserDefaults. The problem is, that when I run my app, the data does not update the labels in the Watch app as I would expect it to. Here is what I have... override init(context: AnyObject?) { // Initialize variables here. super.init(context: context) // Configure interface objects here. NSLog("%@ init", self) var defaults = NSUserDefaults(suiteName: "group.AffordIt") var totalBudgetCalculation = "" if (defaults!

Cannot decode object of class

人盡茶涼 提交于 2019-11-27 00:58:54
问题 I am trying to send a "Class" to my Watchkit extension but I get this error. * Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: '* -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (MyApp.Person) Archiving and unarchiving works fine on the iOS App but not while communicating with the watchkit extension. What's wrong? InterfaceController.swift let userInfo = ["method":"getData"] WKInterfaceController.openParentApplication(userInfo,

WatchKit Extension bundle identifiers

心不动则不痛 提交于 2019-11-27 00:01:34
问题 I am trying to build my app but it failed. I am shown the message below. error: WatchKit Extension doesn't contain any WatchKit apps whose bundle identifiers match "com.domain.appname.watchkitapp". Verify that the value of WKAppBundleIdentifier in your WatchKit Extension's Info.plist matches the value of CFBundleIdentifier in your WatchKit App's Info.plist. I have recently changed "com.domain.appname.watchkitapp" to "com.domain.differentappname.watchkitapp" . I cannot find where to change

App installation failed due to application-identifier entitlement

喜欢而已 提交于 2019-11-26 23:47:18
问题 I am unable to install a watchOS 2 WatchKit app due to an application-identifier entitlement. This happened after turning on App Groups in the Capabilities tab. Full error: App installation failed This application's application-identifier entitlement does not match that of the installed application. These values must match for an upgrade to be allowed. This is running the app in debug mode on a physical device. Running just the iOS app works fine. I have turned App Groups off again and

How to check whether iPhone and apple watch are connected

天涯浪子 提交于 2019-11-26 23:01:23
问题 Is there any way to notify user in Apple Watch that the iPhone is now out of range and when it comes back in range. How can we do it in watch extension. Thanks in advance. 回答1: So on WatchOS 2 that is possible ! You have to do on iPhone side : First : import WatchConnectivity Then : 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

Watch os 2.0 beta: access heart beat rate

拥有回忆 提交于 2019-11-26 22:36:10
问题 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 回答1: 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