apple-watch

Watchkit - How to set the element one below other in Group

…衆ロ難τιáo~ 提交于 2019-12-04 16:26:46
问题 I am working on the watchkit app and I want to create a table row with an image and two labels where the labels are one below the other, like this: I tried the position options in interface builder, but no luck. The labels are always on the same line: I want the x-coordinate same for both. Please help. 回答1: At first, drag a Group onto the interfaceController, then change the Layout property of that group to Vertical : Then drag the Labels in that group and set their properties accordingly: If

How to establish a communication channel between Apple Watch Extension/App and iOS App

浪子不回头ぞ 提交于 2019-12-04 12:29:43
问题 I'm exploring the WatchKit SDK. When I have a WatchKit app, is it possible to set values (e.g. Text, settings) from the iPhone app on the WatchKit app? Can I call functions in the WatchKit app extension from the iPhone app? If someone managed to do this, could he/she post an example? Thanks! 回答1: You can use App Group and sharedDefaults to share data between the WatchApp/Extension and the App on the phone. see example: WatchKit SDK not retrieving data from NSUserDefaults Study up on iOS8

Localize watchkit companion app display name

早过忘川 提交于 2019-12-04 12:10:44
I am having some issues localizing app display name on apple watch companion app. Following the guide lines i have localize the CFBundleName as follow: CFBundleDisplayName = "My app"; CFBundleName = "Myapp"; I did it for every different language supported by my app, but in apple watch companion app it is always shown the english CFBundleDisplayName. Any idea on how properly localize apple watch companion app name? thank you very much for helping I believe that is a bug of the iOS9. The reason is clear, There is no apps on AppStore that provides localized companion App Title. 来源: https:/

Inconsistent behavior of openParentApplication in my WatchKit App

孤人 提交于 2019-12-04 11:16:10
问题 I'm developing an Apple Watch application that uses the openParentApplication:reply: method to communicate with its parent app. The parent app communicates with a web service and sends back the data it gets to the watch extension by means of calling the reply method with a NSDictionary containing the data. The app works perfectly when the parent app is open in the foreground or background. But if I open the parent app and then terminate it using the task switcher, the first time the watch

Running SpriteKit Game in watchOS on Apple Watch Simulator (xCode 8, Swift 3, iOS 10) - libswiftSwiftOnoneSupport Error

…衆ロ難τιáo~ 提交于 2019-12-04 10:54:37
I downloaded xCode 8.0 beta and opened a recent project written in swift 2 which I then converted to swift 3 using xCode. I then added a watchOS target to my project with the setting "game" File > New > Target: I checked the GameScene.swift in the WatchExtension and sure enough all the code is there and sets up a scene: import SpriteKit class GameScene: SKScene { private var spinnyNode : SKShapeNode? override func sceneDidLoad() { if let label = self.childNode(withName: "//helloLabel") as? SKLabelNode { label.alpha = 0.0 label.run(SKAction.fadeIn(withDuration: 2.0)) } let w = (self.size.width

WatchKit CoreLocation issue

核能气质少年 提交于 2019-12-04 10:14:08
I am trying to read current location coordinates in WatchKitExtension ExtensionDelegate. This does though not return any value. The very same code used in WatchKitExtension InterfaceController does return the location. (tried this out of desperation as I could not find an error in the code) I would need to perform this code in ExtensionDelegate as I would like to pass the retrieved location on to a ClockKit Complication. Here the code in ExtensionDelegate: (after self.locationManager.requestLocation() the delegate functions didUpdateLocation / didFailWithError do not get called) import

openParentApplication only works when the app is running in the foreground

[亡魂溺海] 提交于 2019-12-04 09:45:36
I'm trying to request data from the server by using openParentApplication and use it in the watch extension, but I don't get anything back when the main app is not running in the foreground. When the main app is running in the foreground everything works fine. I had this issue before and the reason was that you haven't registered long running background operation and the system kill it. This is how I sorted this, please see comments for explanations, this is all in AppDelegate file and it in swift but you can easily port it to Objective-c: private var backgroundTask: UIBackgroundTaskIdentifier

Why sending message from WatchKit extension to iOS and getting back a reply is so slow?

こ雲淡風輕ζ 提交于 2019-12-04 08:29:28
I am using sendMessage method to send a message from WatchKit extension to an iOS app. It takes about 230 ms on average to receive a reply. The time does not depend on whether the iOS app is on screen or running in the background. 230ms is roughly the time it takes for light to travel the Earth circumference and back. But the phone is sitting 30 cm from my watch when I am testing this. Questions : Why is it so slow? Is it supposed to be so slow? Is there a way to make it faster? An observation: according my previous experiments in watchOS 1 communication was a bit faster, a roundtrip used to

How to automatically set the version and build number of a Watchkit app target

自作多情 提交于 2019-12-04 08:10:41
问题 The version and build number (or version and short version) of a Watchkit app and extension have to be set to the same value as the containing app. I use environment variables to set the apps version in the Info.plist dynamically at build time. That also works fine for the Watchkit extension, but not for the Watchkit app. The environment variables I use have to be provided in the plist for the main app and extension without ${} (for variable ${VERSION} I set VERSION ). if I do the same for

How to set apple watch code signing identity and provisioning profile for push notification?

你说的曾经没有我的故事 提交于 2019-12-04 06:14:20
问题 Got this error: Failed to code sign "xxx WatchKit App". The provisioning profile specified in your build settings (“xxxWatchAppPushProvisionProfile”) has an AppID of “com.yyy.xxxAppleWatchApp” which does not match your bundle identifier “com.yyy.xxxAppleWatchApp.watchkitapp”. Xcode can attempt to fix this issue. I've renamed "com.yyy.xxxAppleWatchApp.watchkitapp" to "com.yyy.xxxAppleWatchApp" but it gives this error instead: 来源: https://stackoverflow.com/questions/30252953/how-to-set-apple