watch-os-2

WCSession sendMessage:replyHandler error code 7014 (WCErrorCodeDeliveryFailed)

徘徊边缘 提交于 2019-12-04 09:00:28
问题 I have a Watch OS 2 application that communicates with the iOS app via WCSession method sendMessage:replyHandler:errorHandler: The iOS application reply correctly but time to time I get the error with code 7014 of domain WCErrorDomain : "Payload could not be delivered" It happens more often when the iOS application is not foreground. I do not find any solution of this problem, I hope one of you know a solution to this problem 回答1: For anyone having issues on iOS10 beta 6 and GM, and you are

Why sending message from WatchKit extension to iOS and getting back a reply is so slow?

こ雲淡風輕ζ 提交于 2019-12-04 08:29:28
I am using sendMessage method to send a message from WatchKit extension to an iOS app. It takes about 230 ms on average to receive a reply. The time does not depend on whether the iOS app is on screen or running in the background. 230ms is roughly the time it takes for light to travel the Earth circumference and back. But the phone is sitting 30 cm from my watch when I am testing this. Questions : Why is it so slow? Is it supposed to be so slow? Is there a way to make it faster? An observation: according my previous experiments in watchOS 1 communication was a bit faster, a roundtrip used to

WatchOS Unit Testing

让人想犯罪 __ 提交于 2019-12-04 01:36:40
I am building an app for Apple Watch and want to write a simple unit test. I looked around and didn't find a single way to add a unit testing bundle for watchOS code. Xcode supports unit tests for iOS, macOS and even tvOS but not for watchOS. Has anyone ever done it and if yes what is the trick? No, watchOS does not currently (as of watchOS 3) support unit or UI testing. What you can do is cross-compile non-watchOS-specific code to a shared library, then unit test that on another platform. 来源: https://stackoverflow.com/questions/33756093/watchos-unit-testing

What is the very reason for WatchKit2 error code 7007 “session on paired device is not reachable”

孤者浪人 提交于 2019-12-04 00:12:49
I am developing a glance view for my Apple WatchOS2 app. I'am currently didn't fully understand the prequisites for a stable WatchConnectivity connection now. I have the strange situation, that in the simulator my ComplicationController could successfully a sendMessage Request. When I try to look at my glance, the sendMessage request failed with: Error Domain=WCErrorDomain Code=7007 "WatchConnectivity session on paired device is not reachable." UserInfo={NSLocalizedDescription=WatchConnectivity session on paired device is not reachable. I have to admit, that I didn't start my app on the

WatchOS 2: “Cannot Install Watch App” “Error Launching 'TestApp WatchKit App Extension'”

烈酒焚心 提交于 2019-12-03 20:39:29
问题 I am getting a AlertView popup error on iOS every time I try to install a watchOS 2 app in Xcode 7 beta 4: Cannot Install Watch App TestApp is installed on your iPhone, but the TestApp app for Apple Watch is currently unavailable. I've also tried installing the watchOS app through the Apple Watch iOS app, but I get the same error. And when I try to run the watchOS target, I get this: Error Launching 'TestApp WatchKit App Extension' Installation error. Check the iPhone console for more details

Duplicating target for WatchOS2 with App and Extension on Xcode

£可爱£侵袭症+ 提交于 2019-12-03 17:24:12
I have a project with a WatchOS2 target along with an Extension. I want to duplicate both the WatchOS App target and the extension. However, when I duplicate the WatchOS App target it is still linked to the old extension. Since we no longer have access to build phases for WatchOS App I cannot change it in the Embed App Extension Phase. Inital State WatchAppTarget1 (Embed Extension - WatchAppExtension1) WatchAppExtension1 Final State WatchAppTarget1 (Embed Extension - WatchAppExtension1) WatchAppExtension1 WatchAppTarget-Duplicate (Embed Extension still pointing to - WatchAppExtension1)

WatchOS 2 (beta 5): watchAppInstalled returns false

ⅰ亾dé卋堺 提交于 2019-12-03 11:09:40
The Watch App is installed on the watch and I can tap and run it on the Watch, but watchAppInstalled method returns false. Also, I can only install the Watch App using Xcode 7. If I try to install the Watch App using the Watch iOS app (from Apple) by turning on the switch, the Watch App gets deleted right after the installation completes. Update: This bug is fixed in Xcode 7 beta 6 Apple Documentation says: The session must be configured and activated before accessing this property. So, you should configure and activate the session before using this property. I had same issue. I just add

WCSession and Today Widget

大兔子大兔子 提交于 2019-12-03 10:13:28
I've an app with a today extension and a watch app. From the main app WCSession works fine and data is transferred to the watch and received correctly but when I try to send or receive data through the WCSession in the today widget the property paired and watchAppInstalled of the session are set to false so calling transferUserInfo: does nothing and session:didReceiveUserInfo: is never called. I know I can open the app using openURL and then send the new data but I want to do that without leaving Notification Center. Does anyone know a nice workaround for this problem? If the watch app is

HKWorkoutSession isn't keeping app at front of Apple Watch

人走茶凉 提交于 2019-12-03 10:05:02
问题 It has been stated that an app running a HKWorkoutSession will have special privileges over other watchOS 2 apps, so when a user looks at their Apple Watch, it will go to the view showing running a workout rather than the watch face. Currently, on both my device and simulator, this is not the case. If I start a HKWorkoutSession and then leave for 5 minutes and then interact with either the Apple Watch, or the Watch Simulator, it presents the watch face. If I then open my app, it appears to

Detecting available API iOS vs. watchOS in Swift

空扰寡人 提交于 2019-12-03 09:04:24
问题 #available does not seem to work when differentiating between watchOS and iOS. Here is an example of code shared between iOS & watchOS: lazy var session: WCSession = { let session = WCSession.defaultSession() session.delegate = self return session }() ... if #available(iOS 9.0, *) { guard session.paired else { throw WatchBridgeError.NotPaired } // paired is not available guard session.watchAppInstalled else { throw WatchBridgeError.NoWatchApp } // watchAppInstalled is not available } guard