watchkit

WatchKit pull to refresh

十年热恋 提交于 2019-12-10 15:12:54
问题 Is it possible to implement a pull to refresh similar to the Watch email app? if not how else should I handle updating a WKInterfaceTable ? I don't really want the app to do an automatic refresh on load as this defeats the purpose of having a quick watch app. 回答1: Unfortunately it isn't possible at this time. WKInterfaceTable , like other WatchKit classes, doesn't offer much in the way of monitoring state. There's no way to monitor the scroll position. Best you could do currently is add a

Xcode - Error launching WatchKit Extension

♀尐吖头ヾ 提交于 2019-12-10 14:07:16
问题 I've successfully built a basic Watch/iPhone app and am getting the following error when trying to run on my devices: "Error Launching 'app_name WatchKit Extension' The operation couldn’t be completed. Unable to launch because it has an invalid code signature, inadequate entitlements or its profile has not been explicitly trusted by the user." The app does install to the watch/phone, but I want to use the extension to view console output while running the app. I am using automatic

How to play a sound for watch kit app

痴心易碎 提交于 2019-12-10 13:49:56
问题 From what I understand it is currently not possible to play a sound from your watch kit app on the watch. If this is the case what is the best way to play a sound? Currently I am using openParentApplication:reply: to run code on the phone that plays the sound. Is this the best way? Update: I also found that I can play audio directly from the watch extension using the same methods as in the parent app. No Idea if this will actually play when not on the simulator. 回答1: There currently isn't any

How can I programmatically compose a message?

最后都变了- 提交于 2019-12-10 13:38:54
问题 How can I open the Messages app on the compose screen, with the message body preloaded with specific text? 回答1: Benjy's answer is almost correct, but has one issue. Since urlSafeBody isn't unwrapped, string interpolation yields sms:&body=Optional("Hello%20World!") which is causing NSURL initialization to return nil, since the URL string is malformed. Here's a working example which conditionally unwraps optionals. This removes any possibility of crashes related to nil optionals being force

Watch OS 2 Issue to set an Image

橙三吉。 提交于 2019-12-10 13:27:37
问题 I just want to add an image to my WKInterfaceController but... Xcode tells me : Unable to find image named "circle44" on Watch @IBOutlet var cirlceImage: WKInterfaceImage! override func awakeWithContext(context: AnyObject?) { super.awakeWithContext(context) cirlceImage.setImageNamed("circle44") } 回答1: Okay I found the result the image have to be in your WatchKt App not on your Extension. And with the addition of app thinning the watch no longer searches for 1x images as they should all be 2x.

Selector not called on selecting menu item after force touch

六眼飞鱼酱① 提交于 2019-12-10 13:04:43
问题 I have this code, for responding to a menu item being tapped after a force touch: class InterfaceController: WKInterfaceController { override init() { super.init() self.addMenuItemWithItemIcon(WKMenuItemIcon.Pause, title: "Pause", action: Selector("test")) } func test() { print("test") } } When I force touch, the menu appears. When I tap the "Pause" button, test() is not called. Any ideas why this might be? 回答1: Solved. Though its the result of a silly mistake (aren't most problems?), I think

How to avoid this error: “Took too long to show custom notification. Falling back to static.”?

浪子不回头ぞ 提交于 2019-12-10 12:42:12
问题 Having issues testing out the custom long look notification on the apple watch simulator. The debugger log this error: WatchKit Extension[5230:156324] Took too long to show custom notification. Falling back to static. How to resolve this issue? 回答1: I had exactly this problem with the default code set up by Xcode. I didn't do any operations inside didReceiveRemoteNotification, but the error still occured. Turns out the reason it failed was that my WKUserNotificationInterfaceController

watchOS 2 working with CocoaPods

天大地大妈咪最大 提交于 2019-12-10 09:46:29
问题 Has anyone gotten CocoaPods working with watchOS 2? I tried using ‘use_framework!’ with ‘platform :watchos, ‘2.0’ but it says "[!] Invalid Podfile file: Unsupported platform watchos2 . Platform must be :ios or :osx .. Updating CocoaPods might fix the issue.” I am on the latest version of CocoaPods. 回答1: CocoaPods currently doesn't support watchos. There is a work in progress issue here for adding support for it. 回答2: CocoaPods released new version which is 0.38.0 and now supports watchOS 2.

HealthKit Permission Sheet Not Appearing

亡梦爱人 提交于 2019-12-10 02:24:54
问题 In my watch extension I call this function: func requestAuthorization() { let healthStore = HKHealthStore() let workoutType = HKObjectType.workoutType() let heartRateType = HKObjectType.quantityType(forIdentifier: .heartRate) //reading let readingTypes = Set([heartRateType!, workoutType]) //writing let writingTypes = Set([heartRateType!, workoutType]) //auth request healthStore.requestAuthorization(toShare: writingTypes, read: readingTypes) { (success, error) -> Void in if error != nil {

Xcode 6.2 watchkit sample app doesn't start. "The operation couldn’t be completed. (LaunchServicesError error 0.) [duplicate]

蹲街弑〆低调 提交于 2019-12-10 00:01:15
问题 This question already has answers here : An error was encountered while running (Domain = LaunchServicesError, Code = 0) [duplicate] (31 answers) Closed 4 years ago . The watchkit sample app didn't start. The message was "The operation couldn’t be completed. (LaunchServicesError error 0.)". The sample app is "WatchKitCatalogUsingWatchKitInterfaceElements", which I got from the Apple Developer library. I tried to reset the contents and settings of the iOS simulator. Any ideas would be greatly