watchkit

WKImage always return nil

寵の児 提交于 2020-01-06 03:14:29
问题 Access assets image will always return nil, below is my code and assets catalog screen shot. let image = WKImage(imageName: "sample") print(image.image) This will always prints nil. Update: Updated screen shot 回答1: I found that from your screenshot you are setting the Image Set in Assests.xcassets in the swiftWatch WatchOS target and i think you are use that image for the WKDemo target so you get that nil. Set that Image Set in your WKDemo's Assests.xcassets instead of WatchOS's Assests

how to pass some message or string from iphone device to paired apple watch

南楼画角 提交于 2020-01-05 09:24:11
问题 I would like to know how a particular message or string can be passed from my iPhone device to the paired iWatch. I would really like to know how this is handled from development point of view. Is there any particular WKInterfaceController method or API which passes the info from iPhone to iWatch? I have read on developer forum that openParentApplication:reply: notifies the iPhone application from iWatch and application:handleWatchKitExtensionRequest:reply handles that particular notification

Apple Watch (WatchKit) push action

断了今生、忘了曾经 提交于 2020-01-04 17:37:13
问题 I am developing an app for the Apple Watch and I would like to use the action demonstrated at the launch event where the user pushes into the screen (rather than a tap). Do you know what this is called and how I can access this? 回答1: You can only show a menu on that action. You use addMenuItem methods on WKInterfaceController. 回答2: The gesture you are referring to is called a Force Touch. It is possible to use Force Touch as an input method in third party apps. You cannot register to receive

Apple Watch (WatchKit) push action

一个人想着一个人 提交于 2020-01-04 17:35:33
问题 I am developing an app for the Apple Watch and I would like to use the action demonstrated at the launch event where the user pushes into the screen (rather than a tap). Do you know what this is called and how I can access this? 回答1: You can only show a menu on that action. You use addMenuItem methods on WKInterfaceController. 回答2: The gesture you are referring to is called a Force Touch. It is possible to use Force Touch as an input method in third party apps. You cannot register to receive

Can a local notification only vibrate the apple watch and not play a sound?

匆匆过客 提交于 2020-01-04 05:37:08
问题 I'd like to schedule a local notification on the phone. When the phone is locked and the watch is sleep I'd like the notification to vibrate the watch but not play a sound. Is this possible? My code below runs on the iphone to schedule the notification but don't know how to suppress the sound when playing on the watch. UILocalNotification *notification = [[UILocalNotification alloc] init]; notification.fireDate = [[NSDate date] dateByAddingTimeInterval:60]; notification.alertTitle = [NSString

How to overlap two controls in iOS watch kit using interfacebuilder

自作多情 提交于 2020-01-04 04:14:48
问题 I have two button with images and i want to overlap one over another. Is it even possible to do it iOS Watch? Moreover, how to handle background or foreground depth of a WKInterfaceObject in watch programming, like sendViewtoBackground or bringSubViewtoFront, as in normal iOS programming ? 回答1: In the watch you don't have a Z hierarchy. The max you can do is using a group, that has a background and then have controls over that background. Another alternative (hack?) is to render all your

How to style rows in SwiftUI List on WatchOS?

谁都会走 提交于 2020-01-03 09:44:12
问题 I'm working with SwiftUI and is trying to make a list of buttons with custom .buttonStyle inside a List view on WatchOS, but can't get it to work. Is this even currently possible, and if so, how? Example project: struct Superhero: Identifiable { var id = UUID() var name: String } var superheroes = [ Superhero(name: "Batman"), Superhero(name: "Superman"), Superhero(name: "Wonder Woman"), Superhero(name: "Aquaman"), Superhero(name: "Green Lantern"), Superhero(name: "The Flash") ] struct

Error: WatchKit Extension doesn't contain any WatchKit apps.

送分小仙女□ 提交于 2020-01-03 08:37:07
问题 Verify that the value of WKWatchKitApp in your WatchKit App's Info.plist is set to YES. 回答1: After weeks and weeks of investigations i finally found out the problem. The product name of the Iphone App was the same as the product name of the Watch App. Once i changed the Product Name of the WatchApp it worked. go to your targets. Select the watch app target go to build settings. Search for Product Name Edit your Product name to be different than the App Target! Clean and Build. Should Work.

Did Apple change NSUserDefaults sharing from iOS app to watchOS app

旧时模样 提交于 2020-01-03 04:44:08
问题 I want to ask about how to use NSUserDefaults on watchOS app. Is its data different from iOS app's NSUserDefaults 's data? There are a lot of stackoverflow questions about this topic and all of them have same answers. That said, for example Watch apps that shared data with their iOS apps using a shared group container must be redesigned to handle data differently. In watchOS 2, each process must manage its own copy of any shared data in the local container directory. For data that is actually

Detecting 'Cover to Mute' action on Apple Watch

被刻印的时光 ゝ 提交于 2020-01-03 03:12:09
问题 There's a feature on Apple Watch where you can cover the screen with your palm to mute it. For example, if you get a call in a meeting, you can cover your watch screen to mute the ring. I would like to use this feature in an app, but can't find documentation that tells me how to detect this action. Does anyone know of how to detect this, or perhaps even how I could simulate this? I know multi-touch is out, and don't know how Apple is detecting the face being covered. 回答1: It's currently not