watch-os-3

Share Realm Data with WatchOS

二次信任 提交于 2019-12-01 06:22:57
In my project I want to use one Realm Database with my iOS 10 application and my watchOs 3 application at the same time. So what I did was adding the frameworks to the embedded binaries for the three different targets. This happened to work very well but the watchKit extension doesn't seem to recognize the objects that I created within the iOS environment. How is it possible to have a shared Realm Database between those two devices? TiM Update: Okay, thanks to chrisamanse 's heads-up, I did some more research on this. It turns out that App Groups are no longer possible on watchOS 2. Watch apps

Share Realm Data with WatchOS

白昼怎懂夜的黑 提交于 2019-12-01 04:20:11
问题 In my project I want to use one Realm Database with my iOS 10 application and my watchOs 3 application at the same time. So what I did was adding the frameworks to the embedded binaries for the three different targets. This happened to work very well but the watchKit extension doesn't seem to recognize the objects that I created within the iOS environment. How is it possible to have a shared Realm Database between those two devices? 回答1: Update: Okay, thanks to chrisamanse's heads-up, I did

WKWatchConnectivityRefreshBackgroundTask is never triggered in background, but WKSnapshotRefreshBackgroundTask

一笑奈何 提交于 2019-11-30 16:12:54
问题 I want to update my watch app state in background from iPhone, using session.updateApplicationContext(applicationContext). Sending an application contact while the app on the watch is active does work properly. When I activate the home button on the watch, the watch app goes to the background, handle(_ backgroundTasks: Set<WKRefreshBackgroundTask>) is called, and a WKSnapshotRefreshBackgroundTask is provided. So I don’t understand why a WKSnapshotRefreshBackgroundTask is triggered properly,

How to build a Workout app on WatchOS with audio feedback?

会有一股神秘感。 提交于 2019-11-30 15:31:21
问题 I am building a very simple workout app on WatchOS: One of it functions is to give audio feedback during the training. I am able to play a file when the display is on, but when the display is dark, the watch doesnt play my file. Can some one look over my swift code and help my figuring out what I am missing? Here is my extensionDelegate.swift: var audioPlayer = AVAudioPlayer() class ExtensionDelegate: NSObject, WKExtensionDelegate { func applicationDidFinishLaunching() { let audioSession =

How to build a Workout app on WatchOS with audio feedback?

廉价感情. 提交于 2019-11-30 14:39:46
I am building a very simple workout app on WatchOS: One of it functions is to give audio feedback during the training. I am able to play a file when the display is on, but when the display is dark, the watch doesnt play my file. Can some one look over my swift code and help my figuring out what I am missing? Here is my extensionDelegate.swift: var audioPlayer = AVAudioPlayer() class ExtensionDelegate: NSObject, WKExtensionDelegate { func applicationDidFinishLaunching() { let audioSession = AVAudioSession.sharedInstance() do { try audioSession.setCategory(AVAudioSessionCategoryAmbient, with:

WKURLSessionRefreshBackgroundTask isn't called when attempting to do background refreshes in watchOS

旧巷老猫 提交于 2019-11-30 09:36:55
I'm working on a complication to get scheduled data from a web service. Every 20-30 minutes (or manually), I am scheduling a WKRefreshBackgroundTask to do this. As suggested by Apple, I want the OS to handle the fetching of this data via a background NSURLSession . This is the function I use to download the data I need: func scheduleURLSession() { print("\nScheduling URL Session...") let backgroundSessionConfig:URLSessionConfiguration = URLSessionConfiguration.background(withIdentifier: NSUUID().uuidString) backgroundSessionConfig.sessionSendsLaunchEvents = true let backgroundSession =

WKURLSessionRefreshBackgroundTask isn't called when attempting to do background refreshes in watchOS

你。 提交于 2019-11-29 14:39:39
问题 I'm working on a complication to get scheduled data from a web service. Every 20-30 minutes (or manually), I am scheduling a WKRefreshBackgroundTask to do this. As suggested by Apple, I want the OS to handle the fetching of this data via a background NSURLSession . This is the function I use to download the data I need: func scheduleURLSession() { print("\nScheduling URL Session...") let backgroundSessionConfig:URLSessionConfiguration = URLSessionConfiguration.background(withIdentifier: