watchkit

Dictionary becomes nil when trying to pass back CLLocation object to iOS app extension

落花浮王杯 提交于 2019-12-13 13:37:48
问题 I'm trying to pass a stored CLLocation object from my iOS app back to an extension (in that case: an Apple Watch extension). For that, I'm using the recommended openParentApplication(userInfo: [NSObject : AnyObject]!, reply: (([NSObject : AnyObject]!, NSError!) -> Void)!) -> Bool function from the WKInterfaceController class in the extension code. I'm successfully receiving the request in my iOS app through the application delegate's application(application: UIApplication!,

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

WKWatchConnectivityRefreshBackgroundTask example

社会主义新天地 提交于 2019-12-13 07:05:23
问题 I want to pass data from my iOS App to my watchOS 3 app using WKWatchConnectivityRefreshBackgroundTask How do I set up code in my watchOS App to handle the data being transferred? For example in the past I used this iOS code to send a message from the iOS App and if there was no connection send a context: func sendTable() { let tableInfo: WatchWorkout = PhoneData().buildWatchTableData(Foundation.Date().refDays()) let archivedTable: Data = NSKeyedArchiver.archivedData(withRootObject: tableInfo

WatchKit willActivate() function. Xcode doesn't like self.view.insertSubview

北城余情 提交于 2019-12-13 06:40:28
问题 I have zero errors. Only problem is nothing displays in my simulator. I'm guessing it's because I don't have anything in awakeWithContext? I did have self.view.insertSubview(heartSymbol, atIndex: 1) but had an Xcode error. http://i.imgur.com/wzOIR2v.png "InterfaceController doesn't have a member named 'view'". I also tried self.heartSymbol = currentBeatPattern.heartImage in the awakeWithContext() function but still no luck. Also I do not have a willActivate() function right now so is that ok

how to make watchkit extension app and my iphone app share the same icloud databases

走远了吗. 提交于 2019-12-13 04:35:13
问题 Im trying to make my app for the apple watch but I am running into a problem with the cloud containers. When I created cloud kit for the watch extension it created its own container/database so now Im trying to get them both to share the same one. Ive tried to specify the custom container I want but it is not working. Please Help! 回答1: Since your watch app will use a specific CloudKit container you have to initiate your container using the identifier. You can not use the defaultContainer. So

iOS WatchKit - Adding Key Value Observer to NSUserDefaults crashes

倖福魔咒の 提交于 2019-12-13 04:27:38
问题 I am trying to add the ability to send data from iPhone to Watch. I have setup App Groups and everything runs smoothly, but when I try to add an observer to NSUserDefaults in the Watch Extension file, the app always crashes on startup. (And yes, I have verified that the app group name is correct and checked in all Target Capabilities AND all provisioning profiles are up-to-date with App Group enabled) Code: override func willActivate() { super.willActivate() NSUserDefaults(suiteName: "my

If Watch app opens before iPhone app runs, no data is populated

寵の児 提交于 2019-12-13 03:59:06
问题 I'm running into a problem where if I run my app in the Watch Simulator before the iPhone Simulator, there is no data in the Watch app. This is because I get the Watch data from the iPhone app (where I query Parse and save the results to the Group Defaults where the Watch can access it), since from what I believe we have been told there is no way to run this sort of function in the Watch app (extension). Am I incorrect about that? How am I supposed to populate the Watch app the first time it

Getting the audio file from the document directory

南楼画角 提交于 2019-12-13 03:39:54
问题 I have looked through the whole internet to find a way to obtain the whole recorded audio file from the document directory. Is there any way to do so? Do you normally do it via an AVAsset/WKAudioFileAsset? I tried to print the Asset and I got something like this here: Are these the .wav files?? I need the recorded .wav files to send them to the server. I hope someone can help me out. Thank you very much. Here is the whole code: http://s000.tinyupload.com/?file_id=38128676605242153939 Here is

Save/Delete to HealthKit With WatchKit and Widget (Today Extension)?

淺唱寂寞╮ 提交于 2019-12-13 02:54:32
问题 Here is a question that I know has an answer since I see apps that do this functionality. I have tried (writing directly, using background fetch) but nothing works. I found an app currently on the app store with the functionality that I am looking for. With Background Fetch set to OFF and main app NOT running in background. I go to the Widget and add an item. I open HealthKit and I see the data there as expected. I would like to do the same for my app. I would like my today extension (widget)

Using WatchKit, how do I position a Label on top of an Image?

被刻印的时光 ゝ 提交于 2019-12-13 02:28:09
问题 Using WatchKit, how do I position a Label on top of an Image? See how the $201.00 is hovering over the Tesla logo? How do you achieve that? I can't figure out how to put things on top of each other in my WatchKit app storyboard. 回答1: Judged by the corner radius of the background image, I would say putting the label into a group, and setting the backgroud image of that group. 来源: https://stackoverflow.com/questions/29068351/using-watchkit-how-do-i-position-a-label-on-top-of-an-image