watchkit

MKMapSnapshotter completionHandler never called in parent app when called from WatchKit

隐身守侯 提交于 2019-12-12 03:36:27
问题 I have this weird issue: I call the parent app with openParentApplication:reply: as normal. It is nicely doing its job getting some data from the internet using async NSURLRequests but when I want to get a map image using MKMapSnapshotter (still in the parent app) its completion block is never called. MKMapSnapshotter *snapshotter = [[MKMapSnapshotter alloc] initWithOptions:options]; [snapshotter startWithCompletionHandler:^(MKMapSnapshot *snapshot, NSError *error) { NSLog(@"completion

Using three arrays to populate complication timeline

梦想与她 提交于 2019-12-12 02:59:55
问题 I have three arrays that have the data to populate the complication timeline with entries. When I scroll through time travel, the complication does not change so I know I must be doing something wrong. func getTimelineEntriesForComplication(complication: CLKComplication, afterDate date: NSDate, limit: Int, withHandler handler: (([CLKComplicationTimelineEntry]?) -> Void)) { for headerObject in headerArray! { for body1Object in body1Array! { for body2Object in body2Array! { let

userInfoTransfer, payload is too big

时光怂恿深爱的人放手 提交于 2019-12-12 02:34:01
问题 I'm trying to send a fair bit of data from a watchOS app, to the iOS app. The data is comprised of generated content on the watch. This data is stored in Core Data on the watch. So I'm not actually transferring a file, in which case I'd use transferFile . I've attempted to use transferFile in this case, but a file URL is required. Since I'm not actually transferring a file, I'm not sure what to do. According to this: WCSession - PayloadTooLarge I'm currently limited to 65.5kb. My average

Max memory usage on watchOS 2?

自闭症网瘾萝莉.ら 提交于 2019-12-12 01:45:16
问题 I didn't find anything regarding the memory usage availavable for an app in watchOS 2. I'm currently developing an app for watchOS and I'm using Core Data in the watch side. When I load 166 of 189 objects to an array, the app crashes, the memory usage at that point is 34mb. As the watch has 512mb of memory I'm not entirely sure how much can you use with just one app. I'm gonna improve my code's performance and ram usage but eitherway I still don't know what amount of memory can I use as it's

Environment variable not passed to Subviews

本秂侑毒 提交于 2019-12-11 19:46:24
问题 I want to get started with Core Data & SwiftUI and therefore created a new watchOS project using the latest Xcode 11.1 GM. Then, I copied both persistentContainer & saveContext from a fresh iOS project (with Core Data enabled), to gain Core Data capabilities. After that I modified the HostingController to return AnyView and set the variable in the environment. class HostingController: WKHostingController<AnyView> { override var body: AnyView { let managedObjectContext = (WKExtension.shared()

Can't get WatchKit URLSession background to work

眉间皱痕 提交于 2019-12-11 19:10:41
问题 I have a file for a BackgroundSession class class BackgroundSession: NSObject { static let shared = BackgroundSession() static let identifier = "com.***.bg" private var session: URLSession! var savedCompletionHandler: (() -> Void)? private override init() { super.init() let configuration = URLSessionConfiguration.background(withIdentifier: BackgroundSession.identifier) session = URLSession(configuration: configuration, delegate: self, delegateQueue: nil) } func start(_ request: URLRequest) {

WatchKit apps/extensions and iOS backwards compatibility

為{幸葍}努か 提交于 2019-12-11 18:25:08
问题 I have an iOS app with its Deployment Target set to iOS 6.1 version, and the Base SDK to latest iOS. I've added both the Watchkit app and WatchKit extension targets to the project, but I need to understand how will this affect a future submission to the App Store: 1) Are two executable files generated? One for the iOS app + WatchKit extension, and another for the WatchKit app? Or is all packaged in an unique executable file? 2) Will it be automatically handled the iOS version of the device

Is there any way of fetching sensors data if watch app goes in background or de-activated?

痴心易碎 提交于 2019-12-11 16:56:46
问题 I am working on watch app extension in which I am collecting the data from all sensors (Accelerometer, pedometer, gyroscope, barometer, location, heart rate etc) in maximum of 100HZ frequency, but I am facing problem with sensors stop giving data in following scenarios: If I drop my arm then sensor works for few seconds after that, sensors do not provide data until I raise my wrist again. Any point of time code execution stops so that we do not get data. So I used CMSensorRecorder class but

Is there REALLY no way to play short sounds on Apple watch without a UI?

时光怂恿深爱的人放手 提交于 2019-12-11 13:56:48
问题 As a learning exercise I decided to write a Simon game for Apple Watch (iOS 9.3, WatchKit 2.0). I created 4 short piano note sounds in GarageBand. I converted them to MP3 files in Audacity, only to find that Apple Watch doesn't support MP3. Ok, great. I need to convert them to WAV or CAF files. Sigh... Anyway, looking into it, it looks like the only way to play any sounds at all is to display a media controller on the watch. (Using either presentMediaPlayerControllerWithURL:options:completion

Can't read WatchKit settings bundle from iPhone app

独自空忆成欢 提交于 2019-12-11 13:24:16
问题 In watchOS 2, it seems like you can't access the data from the WatchKit settings bundle from the watch extension itself, because it now runs on the watch instead of the host iPhone. A solution, which was proposed here, was to read the data on the iPhone and then transfer it to the watch. My problem is, that I cannot only read the data from the watch, but even from my phone. In ViewController.m I have the following code to get the value of a switch: NSUserDefaults *userDefaults = [