watchkit

Share Realm Data with WatchOS

二次信任 提交于 2019-12-01 06:22:57
In my project I want to use one Realm Database with my iOS 10 application and my watchOs 3 application at the same time. So what I did was adding the frameworks to the embedded binaries for the three different targets. This happened to work very well but the watchKit extension doesn't seem to recognize the objects that I created within the iOS environment. How is it possible to have a shared Realm Database between those two devices? TiM Update: Okay, thanks to chrisamanse 's heads-up, I did some more research on this. It turns out that App Groups are no longer possible on watchOS 2. Watch apps

Using firebase with WatchKit

风格不统一 提交于 2019-12-01 05:39:03
问题 I am attempting to use the firebase database in my watchKit app. I have developed this feature on my iPhone application but have found it difficult to do the same on my Watch app. When I attempted to import firebase into the VC class in watch app, it is creating an error no such module 'firebase' . Is it possible to use firebase inside a watch app? 回答1: Sadly there is no Firebase support for watchOS2 and watchOS3 due to the fact that there's no support for CFNetwork in these versions of

Getting server data for the Apple Watch

空扰寡人 提交于 2019-12-01 04:53:23
I am wondering how to go about designing a watchOS app that depends on getting the latest feed from a server. Would you need to use application context and just have the iPhone push it over in the background using the WatchConnectivity framework or would you use NSURLSession on the Apple Watch itself? Keep in mind this is for watchOS 2. You can use NSURLSession to handle your request. So your request would be native on your watchn. But note that your watch is there to show simple Content to the user. 来源: https://stackoverflow.com/questions/31465130/getting-server-data-for-the-apple-watch

WatchKit WKInterfaceLabel can't change font

夙愿已清 提交于 2019-12-01 04:35:45
I'm trying to change label font. But every font I set in the Attributes Inspector different from the system font - don't change anything - neither simulator or storyboard. I even tried to set the font programatically with Attributed string - the same System font appears. Thanks for your help. You cannot use the included iOS fonts in WatchKit at this time. The only one available is System (San Francisco). Source: Apple Developer Forums You can however use a custom font by adding the font file to the project: Drag the font files into the project navigator Include the custom font file in both

Share Realm Data with WatchOS

白昼怎懂夜的黑 提交于 2019-12-01 04:20:11
问题 In my project I want to use one Realm Database with my iOS 10 application and my watchOs 3 application at the same time. So what I did was adding the frameworks to the embedded binaries for the three different targets. This happened to work very well but the watchKit extension doesn't seem to recognize the objects that I created within the iOS environment. How is it possible to have a shared Realm Database between those two devices? 回答1: Update: Okay, thanks to chrisamanse's heads-up, I did

WatchKit UIPageControl Dot Colour

懵懂的女人 提交于 2019-12-01 04:11:12
问题 When I was watching one of the videos from Apple about the Apple Watch and its features I noticed that the page indicator dot colours change depending on the page presented. They've also got images of the coloured dots within the Apple Watch Human Interface Guidelines App Anatomy section. Note the coloured title text as well. Normally in WatchKit I would use the following snippet of code to do this: let features = ["First", "Second", "Third"] let controllers = [String](count: features.count,

WatchKit app submission failure; MinimumOSVersion

£可爱£侵袭症+ 提交于 2019-12-01 04:02:36
Submitting WatchKit 1.2 companion app, fails during validation with this error: ERROR ITMS-90455 "Invalid WatchKit App Bundle. The value '2.1' for the MinimumOSVersion key in info.plist in bundle 'redactedbundlename.watchkitapp' is not supported" I do cannot find a MinimumOSVersion key in the watch app plist or settings, nor in build settings or plist for the phone app. The only mention of anything "2.1" related is in my build settings: Any ideas to diagnose this issue? Fixed it! For some reason, you need to change WATCHOS_DEPLOYMENT_TARGET from 2.1 to 2.0 . You can find this in Project

Load image from URL on WatchKit

▼魔方 西西 提交于 2019-12-01 03:33:54
Is there a more elegant solution to load an external image on the watch than the following ? let image_url:String = "http://placehold.it/350x150" dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) { let url:NSURL = NSURL(string:image_url)! var data:NSData = NSData(contentsOfURL: url)! var placeholder = UIImage(data: data)! // update ui dispatch_async(dispatch_get_main_queue()) { self.imageView.setImage(placeholder) } } NSURL is meant to be used for local files. Instead use NSURLSession. It's also useful to set the scale for the remote image. import WatchKit public

prepareForSegue equivalent in WatchKit

风流意气都作罢 提交于 2019-12-01 03:08:45
I have an interface with 2 buttons, both of them call the same interface but with different information. On the traditional interface I use prepareForSegue, but I don't know what's the equivalent one on the WatchKit. You can do this in two ways: In your storyboard you set an identifier in your segue: and then you can use contextForSegueWithIdentifier : - (id)contextForSegueWithIdentifier:(NSString *)segueIdentifier { if ([segueIdentifier isEqualToString:@"yourIdentifier"]) { return aDictionaryWithYourInformation; } } Or you can pass information with a context via code, with: [self

WatchKit WKInterfaceLabel can't change font

≡放荡痞女 提交于 2019-12-01 01:43:10
问题 I'm trying to change label font. But every font I set in the Attributes Inspector different from the system font - don't change anything - neither simulator or storyboard. I even tried to set the font programatically with Attributed string - the same System font appears. Thanks for your help. 回答1: You cannot use the included iOS fonts in WatchKit at this time. The only one available is System (San Francisco). Source: Apple Developer Forums You can however use a custom font by adding the font