Watch Connectivity

RSS for tag

Implement two-way communication between an iOS app and its paired watchOS app using Watch Connectivity.

Watch Connectivity Documentation

Posts under Watch Connectivity tag

44 Posts
Sort by:
Post not yet marked as solved
1 Replies
86 Views
I am trying to get iPhone and watch simulator to send message to each other. I am getting this error(s) all the time: Error Domain=WCErrorDomain Code=7012 "Message reply took too long." UserInfo={NSLocalizedDescription=Message reply took too long., NSLocalizedFailureReason=Reply timeout occurred.} -[WCSession _onqueue_notifyOfMessageError:messageID:withErrorHandler:] 0F2558A6-6E42-4EF1-9223-FBC5336EE490 errorHandler: YES with WCErrorCodeMessageReplyTimedOut Is there are some guideline on how to connect them together? Maybe I a missing some step. For clarification, sometimes they do connect but it feels like pure luck. Please help.
Posted
by atamanata.
Last updated
.
Post not yet marked as solved
0 Replies
85 Views
Enable Developer Mode - Missing Trust this computer - Missing, if the prompt happens and you accidentally tap the verbiage or the crown before scrolling to the buttons, you never ever see the trust this computer again. Double tapping the side button or crown to kill apps is a game of roulette. If you don’t swipe the app in mere seconds the list disappears or one of the background apps becomes active. After upgrading all watches to 10.4 and pairing to a phone guess what? Enable developer mode - missing. Now I have a few watches that cannot be used for development. When is Apple going to address this glaring bug people have been reporting and talking about in the forums for almost a year with versions of watchos from as early as 9.x and iOS 16?
Posted
by MobileTen.
Last updated
.
Post not yet marked as solved
1 Replies
405 Views
Hey there, I'm implementing Watch Complications in an existing project, and I'm having the problem that transferCurrentComplicationUserInfo(_:) works exactly as transferUserInfo(_:) is described in the documentation, but not as it should. That is, when the WatchApp is opened, func session(_ session: WCSession, didReceiveUserInfo userInfo: [String: Any] = [:]) receives the data sent by transferCurrentComplicationUserInfo(_:). If not, the data is queued until the Watch App is opened again. In other words, transferCurrentComplicationUserInfo(_:) never wakes up the ExtensionDelegate when the Watch App is not running. Has anyone experienced the same thing and know how to fix it? More details: Testing on iPhone 11 (iOS 17.1.2) and Apple Watch SE (WatchOS 10.2) I made sure that the quota of 50 is not exhausted when I test. The WatchApp is still dual-target (I want to avoid having to migrate to single-target and SwiftUI lifecycle) Watch App code: class ExtensionDelegate: NSObject, WKExtensionDelegate, WCSessionDelegate { let session = WCSession.default override init() { super.init() if WCSession.isSupported() { session.delegate = self session.activate() } } func session(_ session: WCSession, didReceiveUserInfo userInfo: [String: Any] = [:]) { WatchWidgetSessionHandler.shared.processComplicationUserInfo(userInfo) } } IOS App code: class WatchAppDataManager: NSObject, WCSessionDelegate { override init() { super.init() let session = WCSession.default session.delegate = self session.activate() } func sendDataToWidget(for kinds: [WatchWidgetKind]) async { guard WCSession.default.activationState == .activated, WCSession.default.isComplicationEnabled else { return } let widgetsData = dataProvider.getData(for: kinds) if !widgetsData.isEmpty { WCSession.default.transferCurrentComplicationUserInfo(widgetsData) } } }
Posted Last updated
.
Post not yet marked as solved
0 Replies
132 Views
I am working on an application design where I would like to have the Iphone running an app such as Apple Map, and while I might be driving in the car I would like to have my apple Watch invoke a screen shot of the current view of I map showing my location without having to use the iphone. So the Iphone would be active and in a car holder displaying my location on the map. Once I made my route point, such as a waypoint. I would like to press a button on my watch app to do a screen print. Second though is, could I press a button on my Apple Watch app to fire an request to my own IOS Application using WatchConnectivity to capture my Location to a data file. Third thought is could a press a button on my Apple Watch app to interact with an active app, which is an app like a reminder app and create a new Reminder Note in the active app in focus on my Iphone, but is not a component of my IPhone App. Thanks for any insight how I could make a Apple Watch app send Button Presses reliably to my Iphone Application active, so that I. could avoid having to touch my iPhone? Thanks in advance for any guidance.
Posted
by bxw0405.
Last updated
.
Post not yet marked as solved
1 Replies
171 Views
I have a watch companion app that sends several message to the iPhone and the phone replies with the data the watch needs. This works perfectly on the simulator and when I deploy directly from XCode to my phone/watch. However, when deployed to test flight the watch never receives replies from the phone. I've added logging and WCSession is active, WCSession.isSupported is true and WCSession.isReachable is true. The watch just doesn't receive a reply from the phone. Is there something I have to put in the Plist to make this work in Test Flight? Has anyone ever had a similar problem?
Posted
by dlent.
Last updated
.
Post marked as solved
9 Replies
3k Views
Right, this is getting on my nerves now. iOS app installed on iPhone via Xcode. Watch app installed on Watch via Xcode. Both apps are running and are in the foreground. iOS app launches on iPhone and reports: WCSession.isSupported = YES theDelegate.session.isPaired = YES theDelegate.session.watchAppInstalled = NO theDelegate.session.activationState = Activated I press a button in the Watch app. It reports: session == activated and reachable iOS app delegate receives a message from the Watch app: didReceiveMessage (from Watch): message = {     action = giveMeUpdatedItems; } The apps must be installed on the devices in order for the Watch app to have used sendMessage (which is only available if the session is reachable, which it is). iOS app delegate passes that through as a notification to another bit of code that collates the info and sends it back to the Watch app. watchNotificationUpdateData; userInfo = {     action = giveMeUpdatedItems; } That bit of code in the iOS app checks whether we can send data to the Watch app, and doesn't send the data because: WCSession.isSupported = YES theDelegate.session.isPaired = YES theDelegate.session.watchAppInstalled = NO theDelegate.session.activationState = Activated If I remove the check for watchAppInstalled, I get this: Error sending Watch application context: Watch app is not installed. {     NSLocalizedDescription = "Watch app is not installed.";     NSLocalizedRecoverySuggestion = "Install the Watch app."; } I've deleted and reinstalled the app on both devices countless times. I've rebooted the devices, plus the Mac. I've reinstalled Xcode. I've cleaned builds. I've deleted DerivedData. And still it says the companion app isn't installed.
Posted
by darkpaw.
Last updated
.
Post not yet marked as solved
0 Replies
307 Views
There's another thread on here with similar Q but seems to have no resolution. So starting my own. The basics Xcode 15.3.0 beta 3 iOS 17.4 The WatchOS 10.4 I have an iPhone app with a companion watch app. In Xcode if I set the scheme to my iOS app it installs on my phone but the companion watch app does not auto install on my watch. Automatic App Install is turned on in Watch app on iPhone. To run the app on watchOS I have to run it directly from the watch scheme on Xcode. If I delete the app from the watch then go into the iOS watch app on the iOS device to install on my watch I receive an error "This app could not be installed at this time" Is there a known cause solution?
Posted
by RyanTCB.
Last updated
.
Post not yet marked as solved
2 Replies
293 Views
I am developing issuer non-UI extension. In function status i have to return remotePassEntriesAvailable (boolean) and to do that i have to activate WCSession from that Extension to get the remoteSecureElementPasses which are already added to the remote wallet (watch). I have implemented WCSessionDelegate inside the non-UI extension but i can not enable the WCSession. I always get: Error: WCSession has not been activated I saw a comment in this post -> WCSession is not available from iOS extensions, only from the main iOS app. To the point... If the WCSession is not available from iOS extensions how can I properly set remoteSecureElementPasses and implement function remotePassEntries if i can't connect to the watch to see which cards are already enrolled?
Posted Last updated
.
Post not yet marked as solved
2 Replies
422 Views
⌚️Hello, I've noticed in watchOS 10 that when a complication is in the Smart Stack, the value of WCSession.isComplicationEnabled is false. I'm not sure if this is intentional or a bug. It seems trivial at first glance, but it actually affects the communication mechanism mentioned in Implementing Two-Way Communication Using Watch Connectivity. In the following two scenarios, if the user has only added the app's complication to the Smart Stack, then the watch app will not be able to communicate properly with the iOS app. Scenario 1 - WCSession.transferCurrentComplicationUserInfo() // update complications from the iOS app if WCSession.default.isComplicationEnabled { let userInfoTransfer = WCSession.default.transferCurrentComplicationUserInfo(userInfo) // ... } As described in Implementing Two-Way Communication Using Watch Connectivity, when the iOS app proactively updates the data of the watch app, since WCSession.isComplicationEnabled is false, WCSession will refuse to transfer any data. This causes the standalone complication in Smart Stack to not be updated. Scenario 2 - WKApplicationRefreshBackgroundTask When the watch app uses WKApplication.scheduleBackgroundRefresh() to periodically update data, as long as the user has added the app's complication to the watch face, the corresponding WKApplicationRefreshBackgroundTask can be executed periodically in the background to fetch data. However, if the user has only added complication to the Smart Stack, then the watch app will be completely purged, and the background task will not be executed at all. Although WCSession.isComplicationEnabled is not directly used in this scenario, its behavior appears to be the same, that is, the complication in the Smart Stack is not considered a complication by the system. Should I submit a bug report?
Posted
by Gong.
Last updated
.
Post not yet marked as solved
0 Replies
296 Views
I am experiencing difficulties in fully integrating my Apple Watch with a supervised iPhone under MDM control. While I have successfully paired the watch with the iPhone, I am facing issues with some apps not syncing or appearing on the Apple Watch. This issue persists despite having allowed their bundle IDs in the MDM’s whitelist. Could anyone provide guidance on which specific Apple bundle ID is crucial for maintaining the connectivity and functionality between the iPhone and the Apple Watch? Understanding this would help in ensuring that the necessary bundle ID is whitelisted in the MDM settings, thus resolving the app visibility and functionality issues on the Apple Watch.
Posted
by isach.
Last updated
.
Post not yet marked as solved
0 Replies
327 Views
I am trying to run the watch and iphone simulator at the same time. I have removed all simulators using Xcode Devices & Simulators panel and created a single iPhone with a paired Apple Watch to eliminate as many variables as possible. I have two schemes, my iPhone app scheme and a Watch scheme. The Watch is NOT set to run independently. My problem is that I can not start the iPhone simulator and the watch simulator and debug both at the same time. As soon as I start one or the other the currently running process is killed, making it impossible to debug both at the same time. I feel like I had this working at one point so I'm not sure if this is a regression or not. Using Xcode 15.1.
Posted
by appleaday.
Last updated
.
Post not yet marked as solved
0 Replies
300 Views
https://developer.android.com/build/configure-app-module#set_the_application_id In Android, you can separate a mobile app and a wearable app into different projects and still enable communication by setting the same applicationId in both project's build.gradle.kts files. Thus, one may upload mobile app and wearable app into google store separately, and yet be able to receive/send messages with each other. Is there a similar approach available for iOS and watchOS apps? I tried separating the watchOS app into a new project and setting its WKCompanionAppBundleIdentifier to the original iOS app's Bundle Identifier. But I'm still encountering errors as below: WCSession counterpart app not installed SessionIsNotReachable Am I missing something, or is this approach not feasible on iOS/watchOS? Also, if it is not feasible, I would like to know why such approach is available on Android, but not on iOS. If it is feasible, correction for my approach, or introduction of a new approach would be greatly appreciated.
Posted
by inwoodev.
Last updated
.
Post not yet marked as solved
1 Replies
493 Views
I am trying to add a watch target in my existing project using XCode 15.1 but I am not able to see any watch simulators for this to run my watch app. I created a small sample project separately where I can see watch simulators reflecting in the run destination. Can somebody please help me to locate which property or setting I need to check which is disabling XCode to show watch simulators? I have downloaded the watch simulator.
Posted
by binga11.
Last updated
.
Post not yet marked as solved
0 Replies
503 Views
When connecting my iphone (14pro with iOS 17.2.1) with a paired apple watch (series 9 with OS 10.3), it is not showing up on the devices/simulators list in xcode 15.1. Beyond unpairing/repairing the watch, restarting either iphone or watch, connecting/disconnecting the iphone from the computer or deleting xcode and re-installing xcode, any other suggestions? Under the WatchApp field it shows "no eligible device connected", however, under the console the Apple Watch does appear. I have tried just about everything and can't get the watch to appear in Xcode. I am running all this on a MacBook Pro with Sonoma. Thanks for any assistance!
Posted
by jarns.
Last updated
.
Post marked as Apple Recommended
2.2k Views
The iPhone Target Build Phase for my Apple Watch companion app specifies the source of the Product to embed as: build/Debug-watchos, however, the Watch build is located at build/Debug-watchsimulator. I am receiving an error from Xcode when trying to install the Apple Watch app in the watch simulator, as follows: An application bundle was not found at the provided path. Provide a valid path to the desired application bundle. Failed to install the requested application Domain: NSPOSIXErrorDomain Code: 2 Failure Reason: An application bundle was not found at the provided path. Recovery Suggestion: Provide a valid path to the desired application bundle. I have tried deleting the Watch target and re-adding the target but the misconfiguration remains. I have also tried adding my own Copy Build Phase but when selecting the Product for the Apple Watch companion app the same incorrect folder is used. Any ideas?
Posted
by appleaday.
Last updated
.
Post not yet marked as solved
1 Replies
432 Views
We are working on a WatchKit app that streams heart rate data to a companion iOS app. This works very well with WCSession, however, when the WatchKit app sleeps, the data does not continue to stream. The only way to get the data to stream again is by moving/touching the Apple Watch and waking it up again. We tried implementing a WKExtendedRuntimeSession, but we were unable to send data with this session. Is there a way to have data to continue to stream continuously, even if the watchkit app falls asleep? WatchOS: 8.8.1 iOS: 17.0 XCode: 15.0.1
Posted Last updated
.
Post not yet marked as solved
0 Replies
458 Views
TLDR: How can I listen to changes in SwiftData and share the data via WatchConnectivity? I am developing an app for the Apple Watch where the iPhone can act as a remote for the Watch. The App on the Watch should work independently from iPhone. The user can create elements on the Watch and start the action associated with the element. The iPhone user can see the elements created on the Watch and start the action on the Watch from the iPhone (if possible I want to add the functionality to let the user update the elements on both devices, but that's not a priority atm). I tried to get it to work with CloudKit and SwiftData, but somehow I couldn't get CloudKit to initialize correctly. After further research, I reconned that using WatchConnectivity and ApplicationContext should be a suitable approach. To communicate with the iPhone App, I created a singleton class that manages the communication. Now I want this class to listen to the changes in SwiftData to send the elements to the iPhone, but I don't know how I can get access to the ModelContext in the Communicator class. I read that passing the value from the initializer of a view is not good practice and it didn't work for me. What would be a suitable way to achieve the desired behavior of my app? Any help and feedback is appreciated. TIA
Posted
by De Mo.
Last updated
.