watchkit

can setText for WKInterfaceLabel in init method but not in didselectrow method

南笙酒味 提交于 2019-12-07 03:03:28
I have a storyboard with two scenes, both scenes are handled by the same WKInterfaceController . In the second scene there are 3 WKInterfaceLabels In the init( ) method of the interface controller I am able to change the Label with setText function. When I try to change the WKInterfaceLabel "Dienst" in - (void)table:(WKInterfaceTable *)table didSelectRowAtIndex:(NSInteger)rowIndex NSManagedObject *dienst = [TableArray objectAtIndex:rowIndex]; [self.Dienst setText:@"Selected"]; NSError *error; NSString *MP = [self read_KC_Pass:&error]; [self.Benutzer setText:[self get_Benutzer:[dienst

Where to find Taptic feedback API documentation or capabilities for watchOS 2?

十年热恋 提交于 2019-12-06 18:58:22
问题 I'm interested in building an app for watchOS 2 using haptic feedback. Currently I do not have the Apple Watch, but I have access to the Apple Developer Program. I've tried looking at the watchOS Developer Library and watchOS 2 Release Notes. I do not see any mention of how to access the Taptic engine programmatically or what it is capable of in the current watchOS 2. How can I access the Taptic engine programmatically or understand what the new Taptic API is capable of doing? 回答1: You can

Calories not being recorded for HealthKit Watch app

自作多情 提交于 2019-12-06 17:57:05
问题 I can't get any calories/activeEnergyBurned to show up in my app, and don't know why? WorkoutInterfaceController : private func totalCalories() -> Double { return totalEnergyBurned.doubleValue(for: HKUnit.kilocalorie()) } private func setTotalCalories(calories: Double) { totalEnergyBurned = HKQuantity(unit: HKUnit.kilocalorie(), doubleValue: calories) } func startQuery(quantityTypeIdentifier: HKQuantityTypeIdentifier) { let datePredicate = HKQuery.predicateForSamples(withStart:

Using the same file with different flags in WatchKit and host App

微笑、不失礼 提交于 2019-12-06 16:20:18
I'm trying to use the same code in both my watchkit extension and host App, but with some additional code in the host App and some additional code in the watchkit extension. To do this I've added WATCH and APP swift flags on the respective targets. Problem is, when I look at my code with my App scheme selected, it doesn't syntax highlight the APP code but does highlight the WATCH code, and other code that refers to the APP code then fails to compile. The watchkit extension is a target dependency of the App so I'm guessing it's something like it is compiling the code for the watch and then

apple watch http request

三世轮回 提交于 2019-12-06 10:27:57
问题 Using import, I can use this module for iPhone, but not for apple watch app.I also want to use this library for writing apple watch app. Is it possible? If possible, how? Can you please provide an alternative if it is not possible? Thanks beforehand Simple example of http request for iPhone import Alamofire Alamofire.request(.GET, requestUrl, headers: self.headers(), encoding:.JSON).responseJSON { (rJ) -> Void in let data = rJ.result.value let err = rJ.result.error } 回答1: Sample Http request

Localize watchkit companion app display name

陌路散爱 提交于 2019-12-06 06:47:08
问题 I am having some issues localizing app display name on apple watch companion app. Following the guide lines i have localize the CFBundleName as follow: CFBundleDisplayName = "My app"; CFBundleName = "Myapp"; I did it for every different language supported by my app, but in apple watch companion app it is always shown the english CFBundleDisplayName. Any idea on how properly localize apple watch companion app name? thank you very much for helping 回答1: I believe that is a bug of the iOS9. The

Change text color of WKInterfaceLabel using NSMutableAttributedString

廉价感情. 提交于 2019-12-06 06:36:30
问题 I'm trying to change text color in WKInterfaceLabel using setAttributedText property. Here's the code: MyRowController *row = [self.interfaceTable rowControllerAtIndex:idx]; NSString *str_tmp = @"Test"; NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:str_tmp]; [text addAttribute:NSFontAttributeName value:[UIFont fontWithName:FONT_REGULAR size:12.0] range:NSMakeRange(0, str_tmp.length)]; [text addAttribute:NSForegroundColorAttributeName value:[UIColor

WatchKit CoreLocation issue

寵の児 提交于 2019-12-06 05:16:38
问题 I am trying to read current location coordinates in WatchKitExtension ExtensionDelegate. This does though not return any value. The very same code used in WatchKitExtension InterfaceController does return the location. (tried this out of desperation as I could not find an error in the code) I would need to perform this code in ExtensionDelegate as I would like to pass the retrieved location on to a ClockKit Complication. Here the code in ExtensionDelegate: (after self.locationManager

WatchKit app “Unlock to activate”

本小妞迷上赌 提交于 2019-12-06 04:38:04
My IOS app reads the heart rate from a bluetooth heart rate sensor, the heart rate is displayed on the Apple Watch. Everything works fine. But in most cases the user will lock the iPhone and put it in his pocket. Here is the problem: The IOS app is still working in the background and reading the heart rate but I can no longer display the data on the Apple Watch because the simulator displays "Unlock to activate". Is it not possible to continue with the WatchKit app when the iPhone is locked and the IOS app is in the background? I found the correct answer at the Apple Developer Forum: Q: If you

How to use alternate font weights (e.g. “short”) in a WKInterfaceLabel?

拥有回忆 提交于 2019-12-06 04:34:48
In Apple's Apple Watch Design Resources , there is a document called Alternate Font Weights and Italicizations . In it, it shows examples of what the default font looks like with different attributes such as Italic , Emphasized , and Short applied to it. Assume I want to use a font that looks exactly like the "Short" example. Is there any way to choose this font and style via the storyboard for a label? In code, how would I set a label to use this font and style? Senseful In an iOS project, I tried modifying the body font ( UIFontTextStyleBody ) to include UIFontDescriptorTraitTightLeading .