watchkit

Scroll long text inside WKInterfaceLabel?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-02 02:19:11
问题 Simple question: is there a way to make a WKInterfaceLabel scroll if its text is too long to fit within the label’s frame? Something akin to a UITextView ? 回答1: You can definitely do this. All you need to do is set the following properties on the WKInterfaceLabel in the Storyboard. Label => Lines = 0 (WatchKit will set the right number) Size => Width = "Relative to Container" Size => Height = "Size to Fit Content" This will let you scroll to your heart's content. I just mocked it up in a

Can a real iOS device and Watch Simulator communicate for Testing purposes

心不动则不痛 提交于 2020-01-02 01:16:05
问题 I want to create a watch app for an existing iOS app. But I am in a situation that i don't own a apple watch and my existing iOS app will run only on real devices not on simulator. Is it possible to run the app on the iphone device and test my watch app in the watch simulator? 回答1: Pairing a real iPhone and a Watch simulator is not possible at least at the moment. I make this conclusion because of 3 reasons: A Watch simulator automatically pairs to an iPhone simulator during the installation

How can I set the backgroundColor of a WKInterfaceController programmatically?

一笑奈何 提交于 2020-01-02 01:10:14
问题 I couldn't find any way of changing the overall background color of the Watch app interface programmatically. I therefore tried creating a fullscreen WKInterfaceGroup and changing the backgroundColor of that. centralGroup.setBackgroundColor(UIColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)) However, I still have unfilled rounded corners and lines on borders. Is there any way to achieve my goal, of an edge-to-edge background color that fills the screen? 回答1: While you can set a background

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

iOS WatchKit - how to determine if your code is running in watch extension or the app

寵の児 提交于 2020-01-01 05:23:07
问题 With WatchKit you have your app that runs on the phone, and the watch app that runs as an extension. If you create a library that contains common code to be used in both the phone app and the watch extension, is there a way to tell if the code is running in the phone app or the watch extension? I.e. if ([self isRunningInWatchExtension]) { NSLog(@"this is running on watch"); } else { NSLog(@"this is running on phone app"); } - (BOOL)isRunningInWatchExtension { ??? } 回答1: I've accomplished this

does NSURLSession send user-agent automatically

旧巷老猫 提交于 2020-01-01 03:39:07
问题 Does NSURLSession send user-agent automatically when user WatchKit 2.0, iOS 9.0? Is there a way to verify this within the WatchKit app? 回答1: Yes, a user agent is automatically provided as part of the default session configuration. The default NSURLSession request header User-Agent field includes the Bundle Name ( CFBundleName ) and the Build Number ( CFBundleVersion ) of your watchOS app extension: $(CFBundleName)/$(CFBundleVersion) CFNetwork/808.3 Darwin/16.3.0 Notice that your app's Version

Max memory usage on watchOS 2?

亡梦爱人 提交于 2019-12-31 06:54:41
问题 I didn't find anything regarding the memory usage availavable for an app in watchOS 2. I'm currently developing an app for watchOS and I'm using Core Data in the watch side. When I load 166 of 189 objects to an array, the app crashes, the memory usage at that point is 34mb. As the watch has 512mb of memory I'm not entirely sure how much can you use with just one app. I'm gonna improve my code's performance and ram usage but eitherway I still don't know what amount of memory can I use as it's

Watchkit not calling willActivate method

不打扰是莪最后的温柔 提交于 2019-12-31 01:00:16
问题 Throughout all the betas of Watchkit I was able to run my watch app seamlessly, but with the recent release this past week (8.2) my willActivate method is hardly ever called. What happens is awakeWithContext gets called and the watch stalls with the spinner spinning forever. Has this issue happened to anyone? 回答1: I've found that locking and unlocking the device (simulator) by typing Command-L will cause the willActivate method to be called. I hope you don't have to do that on a real Apple

Compare WKInterfaceLabel Text to Another NSString

六眼飞鱼酱① 提交于 2019-12-30 11:59:44
问题 I know there is no getter method for WKInterfaceLabel, but is there another way for me to compare the label text to another string? If this wasn't a watch app and I was using UILabel I could just do this: if ([self.label.text isEqualToString:someString]) { } 回答1: There's no supported way to get the text, just as you said, however you may want to use the accessibility elements as "option". Here's the idea: When self.label text is set (either in code or storyboard) also set the corresponding

Can I keep my WatchKit App running in the background on the Apple Watch?

被刻印的时光 ゝ 提交于 2019-12-30 10:02:05
问题 I want to know if there is anyway to keep my WatchKit app running in the background, or if I can possibly program it to launch (i.e. transfer from inactive state to active state) once a certain condition is fulfilled? My app is running perfectly while the WK App is open and active, and it even runs fine when the iPhone is asleep, or when the parent iOS app is in BG mode. However, I really need my app to continue running in the background on the watch itself. Is this possible? 回答1: Not