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

51 Posts
Sort by:
Post not yet marked as solved
0 Replies
392 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
356 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
558 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
594 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.4k 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
478 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
510 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
.
Post marked as solved
338 Replies
396k Views
Hi. I am pairing my Apple Watch Series 5 to my iPhone running ios 14. The pairing is successful but unable to proceed with the set up because an update is needed to be downloaded first. I updated the os for watch but I keep on getting “Unable to Check for Update - Checking for a software update failed because you are not connected to the internet”. I am definitely connected to the internet. Watch was reset to factory defaults and I am now pairing it as a new device but it fails due to the issue mentioned above.
Posted Last updated
.
Post not yet marked as solved
2 Replies
583 Views
I have a WatchOS app that uses Push Navigation. I statrted to make a change this morning (Xcode 15.0, watchOS10), and discovered that the look of Push Navigation has changed dramatically. Instead of a back arrow "<" and title in the upper left corner, there is now a larger "<" in a dim circle, and the title is right-justified under the clock, with some background transparency. See attached image for a "old vs. new" comparison. In several cases, this isn't a problem, but I have some scenes in my app that require just about every bit of real estate of the screen, and now the UI loses a significant amount of room at the top. Does anyone know if there's a way to force the old behavior? If not, I may need to do some significant jiggering of my user interface!
Posted
by MowinMan.
Last updated
.
Post marked as solved
3 Replies
1.1k Views
When calling WCSession.default.transferCurrentComplicationUserInfo , the watch extension does not wake (init is never called) when the watch application is inactive. It does work fine when the watch application is in the foreground. And the didReceiveUserInfo is being called. WidgetKit developer mode is set, so that remainingComplicationUserInfoTransfers is not an issue. using watchOS 9.5 and SwiftUI / WidgetKit complications.
Posted Last updated
.
Post not yet marked as solved
0 Replies
347 Views
I'm currently developing an app for watchOS and I need to programmatically check the status of the paired Apple Watch within my app. Specifically, I want to determine if an Apple Watch is currently paired with the user's iPhone, or which watch is actively paired with user's iPhone if they switch to different watch. What is the recommended approach or API in watchOS to achieve this? Going through both DeviceInformation queries and DDM status channel, but I don't see anything helpful.
Posted
by mary2023.
Last updated
.
Post not yet marked as solved
2 Replies
2.2k Views
Hi there, I have a problem archiving a Flutter App containing an Apple WatchOS Target. The WatchOS target is built with the new logic, containing only one app and no Watchkit extension. When I build the app on my iPhone/Simulator everything is working just fine and they can communicate without any problems. The error occurs when I'm trying to upload my built archive to App Store Connect for Testflight testing purposes. It fails with the error Asset validation failed: "Missing Info.plist value. A value for the key “WKApplication“, or “WKWatchKitApp“ if your project has a WatchKit App Extension target, is required in “Runner.app/Watch/MyWatchOSApp Watch App.app“ bundle. For details, see: https://developer.apple.com/documentation/watchkit/creating_independent_watchos_apps/setting_up_a_watchos_project". I tried to fix it by adding a info.plist to the WatchOS target, which isn't created initially. By doing so I can not build the Runner App anymore because it fails with "A WatchKit app within this app is not a valid bundle.". Can anyone help me fix it please? Thank you! Greetings
Posted
by DevOops.
Last updated
.
Post not yet marked as solved
10 Replies
3k Views
We are migrating ClockKit complications to WidgetKit in our watch app (watchOS 9+). The migration went smoothly, UI part works just fine. However, we've hit the wall with widgets not updating when requested by the watch app. I believe we are missing something very simple and fundamental, but couldn't find what exactly so far. Advice and tips would be very welcome! 🙇‍♂️ Our implementation details: Whenever data is changed in the main app, the updated data is submitted to the watch app via WatchConnectivity framework using WCSession.default.transferCurrentComplicationUserInfo(_:). According to documentation, this method should be used to transfer complication-related data, since it will wake the watch app even if it is in the background or not opened at all. Watch app receives updated data and stores it in UserDefaults shared with Watch Widget Extension hosting WidgetKit complications via App Group. Watch app then request widget timeline reload via WidgetCenter.shared.reloadAllTimelines(). According to documentation, it reloads the timelines for all configured widgets belonging to the containing app, so it seems the appropriate way to reload WidgetKit complications. Widget Timeline Provider class in Watch Widget Extension reads updated data from shared UserDefaults and uses it to provide the updated snapshot for widget views to render. We believe our implementation logic is correct, but it doesn't work, for some reason. Widgets sometimes update when the watch app is opened, but not always. The most definitive way to force widgets to update is to switch to a different watch face, which confirms that the Widget Timeline Provider has access to properly updated data. P.S. We are aware of the daily reload budget imposed on widgets, so we use widgets reload trigger sparingly. Anyway, according to documentation, reload budget is not effective when in DEBUG mode, but widgets won't reload even in DEBUG mode. Thank you!
Posted
by Serzhas.
Last updated
.
Post not yet marked as solved
5 Replies
1.9k Views
This questions appears many times here but there has not been a proper response. Assume that the watch is in developer mode. That the phone and the watch are already unlocked. The issuer persists. Perhaps someone at Apple can explain the life cycle for this connection and provide a fool proof way of running the code with the watch connected to Xcode through the iphone. Help here will improve productivity dramatically. Thank you
Posted Last updated
.
Post not yet marked as solved
2 Replies
664 Views
I have an existing iOS/watchOS app that uses a third-party database and WatchConnectivity. For various reasons I am migrating the app to use Core Data with CloudKit. I have everything working using NSPersistentCloudKitContainer. Sync between the iOS and watchOS app are working on my test devices when I start with an empty database. However, I need to import existing user's data when they first install this new version. Some users may have hundreds or thousands of records, but the total database size is under 1-2MB. Data migration/import is working on the iOS side, the Core Data entities are populated on first launch and uploaded to CloudKit (I see in the debug logs that a NSPersistentCloudKitContainer.Event export ends successfully). The problem is launching the watchOS app does not sync the data from CloudKit. I see a import started event but never see it end. I never see any Core Data entities appear on watchOS even after waiting several minutes and re-opening the Watch app multiple times. New entities or modifications made on either app are also not synced. Is the problem just too much data which causes the CloudKit sync to never finish? What are the best practice to populate a watchOS app with initial data from the parent iOS app and keep it in sync with CoreData/CloudKit?
Posted
by ehsan.
Last updated
.
Post marked as solved
3 Replies
1.1k Views
I have an iPhone app the uses CloudKit for Core Data syncing. I also have a companion Apple Watch app that syncs to the same CloudKit records. The watch can be used without the iPhone app as well but they both independently sync to the same CloudKit database. This works reasonably well. As soon as either app is opened, the CloudKit will pull down the latest records. I'd like to add a watch complication that shows the state of the CloudKit records. I supported this by adding a Widget extension, embedded in my watch app. The Core Data database in the watch app is part of an app group, so the complication is able to query the same database. So far so good. I'm running into problems with the complication updating after remote records are changed from the iPhone. Here is what is happening: When records are changed on the iPhone, the data syncs to CloudKit but the watch app is not updated when in the background. This is noticed when you open the app and it takes a second for the view to show the new records. Since Core Data database on the watch is not being updated while in the background, the complication is not being updated at all. Part of my confusion is I assumed CloudKit was meant to make this more seamless with silent push notifications? I have the "Remote Notifications" capability enabled on my WatchApp. It seems that only works while the app is in the foreground though. This seems very limiting when you have a complication that depends on the Watch app's Core Data state. I have a few things to work around this with mixed success: "Wake" the watch app explicitly when records are changed on the iPhone app using WatchConnectivityManager. The hope is that by waking the watch app, it will sync with iCloud. This either isn't working or intermittenly works. It is also not clear to me that by activating the watch app, that it will trigger records to sync. I wish there were a way to ask Core Data to sync explicitly. Whenever the Apple watch app wakes in the last step, ask it to WidgetCenter to reload the widget. This process feels convoluted and seems to negate some of the the benefits of CloudKit to synchronize data which I thought would be baked into this process. Any thoughts on a better approach to all this?
Posted Last updated
.
Post not yet marked as solved
1 Replies
471 Views
Hello All, I hope my first post here finds everybody doing well. I wish to develop a simple app. I have some coding experience using other technologies. This would be my first iOS and MacOS app. I am asking for advice regarding the choice of tools and or technology. Here is what I think potential advice givers need to know: Motivation is to keep evil coworkers from messing with my Mac when I step away from, (often), my desk In order to thwart their machinations, I have set my Mac to lock after a very short period of inactivity - this is often a pain as I am sitting at my desk when the Mac locks I wear a fairly new iWatch and am using an M2 Macbook Air I want an app that keeps my Mac from locking when I am nearby I want an agent that runs on my Mac that listens for pings from my iWatch I want an app for my iWatch that pings my Mac It would be nice to be able to set the radius of the "nearby zone" and ping rate A ping would interact with my agent so as to keep my Mac from locking If no ping, Mac locks per whatever time-out setting I have on my Mac I know, I know. I could just use some key combos. No need to point out the obvious way of dealing with the bozos, (we have fun), that I work with. Stymying them in this manner would enhance my happiness. I just want a bit of advice on the appropriate way of going about this. Hopefully, anything I learn might someday be applied to the development of other simple apps. Thanks for any thoughts offered! John Ullom
Posted
by Skygizmo.
Last updated
.