watchkit

Is it safe to use updateApplicationContext to send keychain value

左心房为你撑大大i 提交于 2019-12-08 15:05:13
问题 In watchOS 2, there are no more shared keychains. If I want to send a keychain value from the iOS app to the Watch app, is it safe to send it via WCSession updateApplicationContext? 回答1: As per the Apple Security guideline:- Keychain Data Protection Many apps need to handle passwords and other short but sensitive bits of data, such as keys and login tokens. The iOS keychain provides a secure way to store these items. The keychain is implemented as a SQLite database stored on the file system.

objective c block that waits for another delegate

纵然是瞬间 提交于 2019-12-08 13:41:28
问题 I have a watchkit app that calls a viewcontroller on an iphone app. I have a delegate for a network connection. I'm trying to use a block so that I don't tightly couple my AppDelegate and my view controller too closely. How can I notify my block when the delegate is finished? ViewController.m -(void)getWatchDataWithCompletion:(void(^)(BOOL gotData))completion{ [self setUpAppForWatch]; completion(YES); } -(void)finishedMessageParse:(NSMutableData *)messageData{ //the delegate is finish tell

Exit from a Watchkit app is handled by the Watchkit OS itself, I don't need to clear or reset screen?

元气小坏坏 提交于 2019-12-08 13:34:37
OK, this is pretty basic but I've read the documentation over and over and want to be sure I've got this right. In plain language, my watchkit app will be shut down by some user interaction exiting the app that's external to my code, right? I don't need to clear or reset the screen with any kind of close procedure that sets it up for another run? I don't need to build an "Exit" or "Close app" routine, right? It's confusing because the documentation implies the app will deactivate once it's no longer on screen (presumably by a user action like swiping to another app) and that this will call the

WatchKit Notification Title Color

陌路散爱 提交于 2019-12-08 13:24:29
Is it possible to set the color of the application title (the text that is on a sash). It seems that it is always fixed to white. In my application I have a light background image with a color that is close to white in the right corner. This makes the name of the app barely readable. I could not find a way to customize the app title color neither in xCode nor programmatically. It might well be that it is fixed to white. But if anybody changed it, please share the solution! You can click on the arrow of Static Notification in Storyboard. And in the Attributes Inspector, you can change the Title

Download images in a Table in watch kit async

落花浮王杯 提交于 2019-12-08 13:14:59
问题 I am developing a WatchKit app, I need to get some images(sometimes 50 thumbnails) to fulfill a Table . I am downloading the images in the iOS app and passing them to the WatchKit Extension , but I am having problems. First, I have three buttons, if I press one of them I see a Table with some elements, all of them with image and label . The main problem is when I am downloading those images and I press one item to see its detail, the main thread is blocked and the app doesn't make push to the

Core Data fetch request with WatchConnectivity

一笑奈何 提交于 2019-12-08 13:08:55
问题 I'm currently trying to get CoreData data from my iOS app to the watchOS extension. I'm using the WatchConnectivity Framework to get a dictionary via the sendMessage(_ message: [String : Any], replyHandler: (([String : Any]) -> Void)?, errorHandler: ((Error) -> Void)? = nil) function. The basic connection is working fine. The iOS app is reachable and if I try to reply a sample dictionary everything is working. So far so good, but as I start doing a fetch request on the iOS app in background,

Converting Swift 3 code without use of dispatch_once_t

倾然丶 夕夏残阳落幕 提交于 2019-12-08 12:50:49
问题 Prior to migrating to Swift 3, I had the following code: //Set up singleton object for the tracker class func setup(tid: String) -> WatchGATracker { struct Static { static var onceToken: dispatch_once_t = 0 } dispatch_once(&Static.onceToken) { _analyticsTracker = WatchGATracker(tid: tid) } return _analyticsTracker } I get the following error: 'dispatch_once_t' is unavailable in Swift: Use lazily initialized globals instead Apparently, the conversion tool converted the code to this: class func

Programmatically notification on apple watch. (WatchOS 3)

冷暖自知 提交于 2019-12-08 12:07:19
问题 How I can programmatically make the notification appear only on the apple watch and only when the event occurs. I searched for a long time on the Internet and in the documentation but did not find the answer 回答1: There is no way for you to decide whether the notification appears on the Watch or on the Phone, the system handles this automatically and you cannot change this behaviour. The notification only appears on the Watch if all of the below requirements are met: The connected iPhone's

How to populate table rows, using a [String] array sent from iPhone by Watch Connectivity?

元气小坏坏 提交于 2019-12-08 11:22:23
问题 Basically, it's passing the array fine. It's just when trying to use the enumerated array as the tablerows, it says nil found. PHONE import UIKit import WatchConnectivity class ViewController: UIViewController, WCSessionDelegate { @IBOutlet weak var sendButton: UIButton! var watchSession: WCSession? var arrayCustom = ["thing1", "thing2"] override func viewDidLoad() { super.viewDidLoad() if(WCSession.isSupported()) { watchSession = WCSession.defaultSession() watchSession?.delegate = self

Apple Watch Not Passing Data to iPhone - Swift

烈酒焚心 提交于 2019-12-08 07:34:14
问题 I'm trying to pass a String from my Apple Watch to an iPhone but it seems like it's not connecting. Here's my code: ViewController.swift : import UIKit import WatchConnectivity class ViewController: UIViewController, WCSessionDelegate { @IBOutlet weak var lablel: UILabel! var string = "Hello World" let session = WCSession.default() override func viewDidLoad() { super.viewDidLoad() session.delegate = self session.activate() } func session(_ session: WCSession, didReceiveMessage message: