watchkit

Easy way to update app content via apple watch

橙三吉。 提交于 2019-11-27 17:18:39
问题 I couldn't find an easy way to update the view in my iPhone app when I push a button on the AppleWatch App yet. I tried it with NSUserDefaults Observer like this: iPhone App Viewcontroller(inside ViewDidLoad()): // Create and share access to an NSUserDefaults object. mySharedDefaults = NSUserDefaults(suiteName: "group.sharedTest") //Add Observer NSUserDefaults.standardUserDefaults().addObserver(self, forKeyPath: "test", options: NSKeyValueObservingOptions.New, context: nil) In the Watchkit

WatchKit reloadRootControllersWithNames causing error, with pageController or after push/pop

蓝咒 提交于 2019-11-27 16:30:43
问题 I have a basic watchkit app that loads a page based navigation of 3 interface controllers. This works well, but I'd then like to trigger an action to remove the page-control and essentially revert back to the original InterfaceController that was present when the app first loads. // load page based control, with 3 views. this works ok [WKInterfaceController reloadRootControllersWithNames:@[@"pageController1",@"pageController2",@"pageController3"] contexts:@[@"data1",@"data2",@"data3"]]; //

How to send data from Iphone to Apple Watch in OS2 in Objective-C

这一生的挚爱 提交于 2019-11-27 15:18:21
I've seen a similar question posted on how to send data back and forth in Swift. I'm asking the same question but in Objective-C. I've also viewed Apple's transition docs . I work best with clear examples, rather than lecture material. So if someone has implemented this and wouldn't mind sharing, that would be much appreciated. Philip Here´s a link to a Q/A about WatchConnectivity: Send messages between iOS and WatchOS with WatchConnectivity in watchOS2 I will give you an example go ApplicationContext, there are 2 other messaging techniques with WatchConnectivity. Please watch WWDC2015 session

Passing data back from a modal view in WatchKit

我的梦境 提交于 2019-11-27 14:17:39
When modally presenting, or pushing, an interface controller we can specify the context parameter to pass some data to the new controller as follows. // Push [self pushControllerWithName:@"MyController" context:[NSDictionary dictionaryWithObjectsAndKeys:someObject, @"someKey", ..., nil]]; // Modal [self presentControllerWithName:@"MyController" context:[NSDictionary dictionaryWithObjectsAndKeys:someObject, @"someKey", ..., nil]]; My question is, how can we do the reverse? Say we present a controller modally for the user to pick an item from a list and we return to the main controller, how can

Creating progress circle as WKInterfaceImage in Watch App

谁说胖子不能爱 提交于 2019-11-27 13:10:45
问题 I am trying to create a progress circle for the Apple Watch version of my app. I know that we aren't able to use UIViews (which would make things so much easier!) so I am looking for alternatives. Basically, I would like to create one of these prototypes: The way I was hoping to do things was to add the background layers as a normal WKInterfaceImage and then the progress arrow/line on top as a WKInterfaceImage that rotates around the circle based on the percentage calculated. I have the

How to launch iOS App from Apple Watch?

旧时模样 提交于 2019-11-27 12:26:48
问题 Is there any way to launch the iOS App from Apple Watch? Edit :- Tried using both api below but doesn't work:- Apple Watch Code Calling Inside interfaceController.m + (BOOL)openParentApplication:(NSDictionary *)userInfo reply:(void(^)(NSDictionary *replyInfo, NSError *error)) reply; // launches containing iOS application on the phone. userInfo must be non-nil iOS Code Calling Inside Appdelegate.m - (void) application:(UIApplication *) application handleWatchKitExtensionRequest:(NSDictionary *

Is it possible to position views on top of each other

一个人想着一个人 提交于 2019-11-27 12:14:40
I am building an Watch app where I want to overlay WKInterfaceImage with a group with a bunch of WKInterfaceLabel objects. Can't seem to be able to do this in StoryBoard editor. Has anyone ever been able to achieve laying out views on top of each other for Watch App? PS. I am aware of WKInterfaceGroup setBackgroundImage method. Since I want to do some animation inside WKInterfaceImage, setBackgroundImage is not going to woe for me You can't layout WKInterfaceObjects on top of each other. You can render the labels over your image and then set it. You will have to render the labels for each

Launch host app from watch app

断了今生、忘了曾经 提交于 2019-11-27 11:45:30
问题 I know that the openParentApplication api in watch kit extension can open the host app in the background but not in the foreground. I also tried using openUrl() api of NSExtensionContext as below: NSExtensionContext *ctx = [[NSExtensionContext alloc] init]; NSURL *url = [NSURL URLWithString:@"myScheme://today"]; [ctx openURL:url completionHandler:^(BOOL success) { NSLog(@"fun=%s after completion. success=%d", __func__, success); }]; [ctx completeRequestReturningItems:ctx.inputItems

Where and When to get data for Watch Complication

社会主义新天地 提交于 2019-11-27 11:41:35
After working with complications for a few days, I feel confident saying the following about the update process for updates that happen at a prescribed interval: The system calls requestedUpdateDidBegin() This is where you can determine if your data has changed. If it hasn't, your app doesn't have to do anything. If your data has changed, you need to call either: reloadTimelineForComplication if all your data needs to be reset. extendTimelineForComplication if you only need to add new items to the end of the complication timeline. Note: the system may actually call

Is there an ActivityIndicator in WatchKit for Apple Watch?

一个人想着一个人 提交于 2019-11-27 08:35:09
Is there an ActivityIndicator (or something like it) in WatchKit for Apple Watch? How do you all give the user feedback about some longer lasting background activity? Edit : This answer was originally posted prior to the introduction of Apple Watch models with cellular and wifi connectivity, and thus may no longer apply on newer models of the device (considering significant performance improvements). This thread on the Apple Developer forums has an authoritative answer from an Apple engineer about why you shouldn't be performing network operations with Apple Watch. There are two big reasons