watchos

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

CoreMotion Gyroscope apple watch

痞子三分冷 提交于 2020-01-04 03:53:20
问题 I'm trying to get access to the gyroscope of the apple watch. From what I read it is available in watchos 3. Unfortunately I cannot get it to work. It keeps coming back with "Gyro not available" so motionManager.isGyroAvailable is always false. Here is my code. Any help would be appreciated. import WatchKit import Foundation import CoreMotion class InterfaceController: WKInterfaceController { let motionManager = CMMotionManager() override func awake(withContext context: Any?) { super.awake

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

Retrieve user defaults information from an Apple Watch

久未见 提交于 2019-12-25 09:28:59
问题 I have an iPhone and an Apple Watch paired together, and there are some values stored in the user defaults of the phone. I want my Apple Watch to be able to retrieve that stored information somehow and bring it back to the Watch. What is the best method of achieving this with Swift? 回答1: Since watchOS2 , you don't have any built in function for communicating between the iOS and watchOS app other than the WatchConnectivity framework. Due to the fact that Watch apps are no longer considered App

Setting tintColor for Apple Watch complication

心已入冬 提交于 2019-12-24 17:12:20
问题 I am trying to set the header text color for a Modular Large complication. I have already customized the watch face to use Multicolor. However, when I build and run this code, the header text color is still white (which is the default). Why isn't the color updating? private func templateForClassModularLarge(className: Schedule) -> CLKComplicationTemplateModularLargeStandardBody { let template = CLKComplicationTemplateModularLargeStandardBody() let headerTextProvider = CLKSimpleTextProvider

Exporting SecKey from iOS to watchOS

北慕城南 提交于 2019-12-24 07:19:03
问题 I am trying to sync up private asymmetric keys between my iOS app and its watchOS equivalent. I have tried using SecKeyCopyExternalRepresentation to export it out as CFData and then send it to the watch using WatchConnectivity . However when it gets to the watch I have no way of converting the Data back into a SecKey . I tried using SecKeyCreateWithData in an attempt to recreate it, but it seems that that only works with symmetric keys, for when I tried it it crashed the watch app. Any ideas?

Exporting SecKey from iOS to watchOS

家住魔仙堡 提交于 2019-12-24 07:18:07
问题 I am trying to sync up private asymmetric keys between my iOS app and its watchOS equivalent. I have tried using SecKeyCopyExternalRepresentation to export it out as CFData and then send it to the watch using WatchConnectivity . However when it gets to the watch I have no way of converting the Data back into a SecKey . I tried using SecKeyCreateWithData in an attempt to recreate it, but it seems that that only works with symmetric keys, for when I tried it it crashed the watch app. Any ideas?

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

人盡茶涼 提交于 2019-12-21 19:55:58
问题 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?

iOS - watchOS App publishing issue CFBundleIdentifier collision

那年仲夏 提交于 2019-12-21 03:48:06
问题 After the app uploading I receive the following email We identified one or more issues with a recent delivery for your app, XXX. Please correct the following issues, then upload again. ITMS-90806: CFBundleIdentifier collision - Each bundle must have a unique bundle identifier. The bundle identifier 'org.cocoapods.CocoaLumberjack' is used in the bundles '[CocoaLumberjack.framework, CocoaLumberjack.framework]' CocoaLumberjack is a third party library that I've already used in the past a lot of

Using Core Data with watchOS 2.0

五迷三道 提交于 2019-12-17 15:49:26
问题 I made an iOS/Apple Watch app with WatchKit 1.0 that uses a shared group container and a custom framework to access the same Core Data store. Now, in the transition guide for watchOS 2.0, Apple says this: If your existing Watch app and iOS app use a shared group container or iCloud to exchange data, you must change the way you exchange that data in watchOS 2. Because the WatchKit extension now runs on Apple Watch, the extension must exchange data with the iOS app wirelessly. You can do that