watchos-2

How to transfer a UIImage using Watch Connectivity

ε祈祈猫儿з 提交于 2019-12-18 02:49:11
问题 How can I transfer an UIImage over WatchConnecitivity from the iPhone to the Apple Watch with no user interaction on the phone, and only loads because the watch calls for it programmatically. I need this because the image processing to create the UIImage uses logic unavailable in the Watchkit API, so it must be created from the phone. I have seem some examples of Watch Connectivity using: func startSession() { session?.delegate = self session?.activateSession() } However, I am new to watch

How to get the current location in watchOS 2?

流过昼夜 提交于 2019-12-18 02:00:33
问题 I need to fetch the user current location for the WatchKit App in watchOS 2. How do I do this? 回答1: The other answers are incorrect. You can request location directly on the watch for watch OS2. The available method is called requestLocation . It allows you to request a single location update. E.g. #import <CoreLocation/CoreLocation.h> @interface className : WKInterfaceController<CLLocationManagerDelegate> Then where you want to request location: self.locationManager = [CLLocationManager new]

Call ExtensionDelegate to create/refresh data for Complication

青春壹個敷衍的年華 提交于 2019-12-17 21:06:07
问题 All my data creation is done in the ExtensionDelegate.swift . The problem is ExtensionDelegate.swift doesn't get called before the function getCurrentTimelineEntryForComplication in my ComplicationController.swift . Any ideas? Here is my code and details: So my array extEvnts is empty in my ComplicationController.swift : func getCurrentTimelineEntryForComplication(complication: CLKComplication, withHandler handler: ((CLKComplicationTimelineEntry?) -> Void)) { let extEvnts = ExtensionDelegate

iOS get heart rate from Apple Watch in near real time

二次信任 提交于 2019-12-17 18:27:27
问题 I need to make an app that records heart rate data in near real time and send this data to a server as soon as possible. First I took this approach: Watch os 2.0 beta: access heart beat rate In fact it is working fine. There is new heart rate data in the HealthKit every five seconds. But now I have the problem that I can't sync that with a server. My first approach was the Watch app. The watch was sending data to a server. That doesn't work because as soon as the screen turns black on the

What is the flow for updating complication data for Apple Watch?

别来无恙 提交于 2019-12-17 17:32:12
问题 I've been following a lot of tutorials on the internet to learn how to set up the complication. I have no problem getting the complication set up as expected. Until the initial timeline entries expire. After 12 hours, I do not know how to update it to keep the complication live. I'll share everything I have below and hopefully somebody can help fill me in. Here, I create the variables for my data that I want to display on the complication. struct data = { var name: String var startString:

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

Where and When to get data for Watch Complication

╄→尐↘猪︶ㄣ 提交于 2019-12-17 10:27:11
问题 After working with complications for a few days, I feel confident saying the following about the update process for updates that happen at a prescribed interval: The system calls requestedUpdateDidBegin() This is where you can determine if your data has changed. If it hasn't, your app doesn't have to do anything. If your data has changed, you need to call either: reloadTimelineForComplication if all your data needs to be reset. extendTimelineForComplication if you only need to add new items

Xcode 7 supporting watch OS1 and OS2

為{幸葍}努か 提交于 2019-12-17 09:39:48
问题 I have been fiddling with Xcode 7 for sometime now, I get to know that it supports only Swift 2 and there is no way to support Swift 1.0 or 1.2 in Xcode 7. This is fine. Now coming to WatchOS, can I have two targets one for WatchOS1 and one for WatchOS2 separately in Xcode 7 so that I can support for both?? I was looking into the deployment target setting in the build settings of both the watch target and the iOS app target but I could see only WatchOS2 in the list so Can I support two

Open Safari iOS App from Watch App

痞子三分冷 提交于 2019-12-13 08:07:20
问题 Is it possible to open the safari in iPhone when I click on some link in Apple watch Application? 回答1: This is only possible if the iOS app happens to be running in the foreground. If you use the WatchConnectivity sendMessage API to wake the iOS app up in the background then you won't be able to open URLs and therefore not launch Safari. 来源: https://stackoverflow.com/questions/33450521/open-safari-ios-app-from-watch-app

Socket connection from WatchOS 2 and CFStream

三世轮回 提交于 2019-12-12 18:31:28
问题 I have to connect a remote server via tcp socket from the Watch. I have already written a piece of code using CFStream which works perfectly from the Watch simulator. When I run it on the Watch I get this error: The operation couldn’t be completed. Can't assign requested address (Code = 49) when I try to open the connection to the server using CFStreamCreatePairWithSocketToHost . The Apple documentation declares that CFStreamCreatePairWithSocketToHost is Available in watchOS 2.0 and later. so