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 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
by
Post not yet marked as solved
4 Replies
2.2k Views
My watchOS app crashes when I accept/change the microphone or Bluetooth permission from its companion iOS app. It crashes with the following message in the console. Message from debugger: Terminated due to signal 9 Please let me know a way to identify and fix the exact problem. here are my device logs: Device logs and crash report
Posted
by
Post not yet marked as solved
6 Replies
2.8k Views
When an iPhone is paired with an Apple Watch and receives a critical alert, no sound is played. This makes it very easy to miss such notifications and defeats entirely the purpose of critical alerts. For context, we build an app that improves the care coordination of heart attacks. We send critical alerts to notify healthcare professionals of such emergencies. These events may occur at night, when the user does not wear the Watch, and will therefore be likely to miss the notification entirely, which can be catastrophic. I have searched online thoroughly for work-arounds but have not found anything. Others have asked this before elsewhere but have not found definitive answers: link. Is there anything we can do as developers to force critical alerts to be handled by the phone, or at least to force the phone to ring when receiving a critical alert? Edit: I am aware that in the Watch app, it is possible to prevent notifications from being mirrored by the Watch. However, this requires the end user to exit my app and navigate their settings. It is also impossible for my app to check if this was done correctly. As such, I am completely in the blind as to whether the user has set up their notifications correctly.
Posted
by
Post marked as solved
9 Replies
3.2k 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
Post not yet marked as solved
1 Replies
1.6k Views
Hi, I'm trying to make a watch app that transfer data watch to watch(or iOS). (Not for backup) So, I looked up for core bluetooth feature. It was a nice and kind document. However, I bumped in to a problem that might cause a severe flaw in my project, which is.. the distance (range) that the apple watch can reach to another one. I googled it and found out 33 feet would be the limit range of bluetooth 4.0 (or 5.0 whatever). BUT, when I google just "bluetooth 4.0 and 5.0 range", the range was way over the distance mentioned, like 10 times way further. Some say up to 100m (330 feet), other say 60m (200feet). So If is there anyone who tested the real range of bluetooth working via watch to watch?? Well.. thank you for reading my post, and I hope anyone can answer me! :)
Posted
by
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
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
by
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
by
Post not yet marked as solved
1 Replies
710 Views
Is it possible to share data between multiple Watches paired to the same iphone? Background: We are developing an app that collects sensor data from Apple Watch and uploads it to the cloud via iphone. Problem: We aim to upload sensor data files from all Apple Watches to the cloud, even when multiple watches are paired to a single iPhone. However, in reality, only the files from the currently active Watch are sent. If we could share data among multiple Watches, we could solve this problem. Please let me know if you have any other good solutions.
Posted
by
Post not yet marked as solved
2 Replies
531 Views
Hello, I am trying to send data from a Watch App to an iOS companion app. However when I call: WCSession.default.transferFile(file, metadata: [fileName:fileName]) nothing seems to happen, since func session( _ session: WCSession, didFinish fileTransfer: WCSessionFileTransfer, error: Error? ) is never called on the delegate. I have done all the necessary linking between the two apps, activated the WCSession.default and set the delegate in both, etc. I confirm the setup is correct by doing this series of checks before invoking the transferFile function: func canSendMessages() -> Bool { /* We can only send messages if the WatchConnectivity Session is activated and the companion app to this app is installed */ if WCSession.default.activationState != .activated { return false } #if os(iOS) if !WCSession.default.isWatchAppInstalled { return false } #else if !WCSession.default.isCompanionAppInstalled { return false } #endif return true } Has anyone run into this before / have suggestions to unblock? Using watchOS 9.4
Posted
by
Post not yet marked as solved
0 Replies
369 Views
Hi, I am developing web sites (privately) and I am looking for a developer who could provide a companion App to my site https://coldmonkey.com. This is a very simple site to bring small bits of information across to someone else. Basically, you open https://coldmonkey.com on one device (a phone, tablet, computer) and type a short text there. The website will generate a second site with a random URL – use a second device to access that URL and display the text. This is useful for prompting/helping other people publicly speaking or similar. I now want to bring the display of the text also to an Apple Watch - can someone help me on that? There is more information available on http://stuff.frankdux.de/?p=246. And sorry, this is not a paid job. The entire service of https://coldmonkey.com is free, so unfortunately I cannot pay for that. But I really appreciate your help! Thanks, Frank
Posted
by
Post not yet marked as solved
0 Replies
420 Views
Dear Apple Support Team, I am reaching out to inquire about the process to enable the health-related features of the Apple Watch Series 8 in Pakistan. Your valuable guidance and assistance in making these features accessible would be greatly appreciated. Thank you for your attention to this matter. Sincerely,
Posted
by
Post not yet marked as solved
1 Replies
418 Views
I'm using Watch Connectivity to transfer files from the Watch to its paired iOS device. File transfer is successful in my first tests, but obviously I need to erase the source file when it is - successfully - sent. When should I do that? just after initiating the file transfer, using transferFile(file: NSURL, metadata: [String : AnyObject]) when getting the returned WCSessionFileTransfer? when getting the callback func session(_ session: WCSession, didFinish fileTransfer: WCSessionFileTransfer ? --> but will the callback always be called, even if the transfer finishes while the app is in background? some other time? NB: I'd really want to avoid implementing a custom 'ack' system, thus not using any user info/application context transfer.
Posted
by
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
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
by
Post not yet marked as solved
0 Replies
788 Views
I'm having a weird issue. I have a watch app which communicates with the phone using a WCSessionDelegate. if the phone app is open everything works fine, but if the app is closed, when the watch sends a message, my app is woken from the background, after which onAppear() is called in my app which causes a swiftData query to run. Calling any swiftdata function from a backgrounded app causes it to immediately crash with the following stack trace. Any ideas what im doing wrong? or a better way to trigger my code instead of onAppear, so it won't be called when my watch wakes my app from the background? .onAppear { reloadData() } private func reloadData() { let fetch = FetchDescriptor<SavedServer>( predicate: nil, sortBy: [.init(\.displayOrder)] ) guard let results = try? modelContext.fetch(fetch) else { self.rows = [] return } self.rows = results } ------------------------------------- Translated Report (Full Report Below) ------------------------------------- Incident Identifier: 057999AF-7840-410E-B3EE-29082C5AED00 CrashReporter Key: 28AF2AA0-4626-9964-9664-36077DAF4E1A Hardware Model: MacBookPro18,2 Process: MC Status [68915] Path: /Users/USER/Library/Developer/CoreSimulator/Devices/C61698BA-C4CA-4DD9-B824-DBF57AC65090/data/Containers/Bundle/Application/A685371C-9174-4CF7-9E99-D573310CC3E5/MC Status.app/MC Status Identifier: com.shemeshapps.MinecraftServerStatus Version: 2.0 (1) Code Type: ARM-64 (Native) Role: Non UI Parent Process: launchd_sim [55432] Coalition: com.apple.CoreSimulator.SimDevice.C61698BA-C4CA-4DD9-B824-DBF57AC65090 [164301] Responsible Process: SimulatorTrampoline [53834] OS Version: macOS 13.4.1 (22F82) Release Type: User Report Version: 104 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Triggered by Thread: 0 Last Exception Backtrace: 0 CoreFoundation 0x18046589c __exceptionPreprocess + 160 1 libobjc.A.dylib 0x18005c09c objc_exception_throw + 56 2 CoreData 0x184989b94 -[NSFetchRequest(_NSInternalMethods) _incrementInUseCounter] + 0 3 CoreData 0x1849aa99c -[NSManagedObjectContext executeRequest:error:] + 164 4 CoreData 0x1848fe250 NSManagedObjectContext.fetch<A>(_:) + 80 5 SwiftData 0x1a89b7ad8 ModelContext.fetch<A>(_:) + 124 6 SwiftData 0x1a89c48c0 dispatch thunk of ModelContext.fetch<A>(_:) + 20 7 MC Status 0x102530ef4 MainAppContentView.reloadData(forceRefresh:) + 752 (MainAppContentView.swift:112) 8 MC Status 0x102533540 closure #2 in MainAppContentView.body.getter + 44 (MainAppContentView.swift:78) 9 SwiftUI 0x108a0b7a0 0x107b8c000 + 15202208 10 SwiftUI 0x108a0b7bc 0x107b8c000 + 15202236 11 SwiftUI 0x108a0b7a0 0x107b8c000 + 15202208 12 SwiftUI 0x108fdce70 0x107b8c000 + 21302896 13 SwiftUI 0x108fd6ec0 0x107b8c000 + 21278400 14 SwiftUI 0x1081edb24 0x107b8c000 + 6691620 15 SwiftUI 0x10928d650 0x107b8c000 + 24122960 16 libdispatch.dylib 0x1801424f4 _dispatch_call_block_and_release + 24 17 libdispatch.dylib 0x180143d3c _dispatch_client_callout + 16 18 libdispatch.dylib 0x180152b24 _dispatch_main_queue_drain + 1272 19 libdispatch.dylib 0x18015261c _dispatch_main_queue_callback_4CF + 40 20 CoreFoundation 0x1803c61b4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 21 CoreFoundation 0x1803c08cc __CFRunLoopRun + 1936 22 CoreFoundation 0x1803bfd28 CFRunLoopRunSpecific + 572 23 GraphicsServices 0x189864bc0 GSEventRunModal + 160 24 UIKitCore 0x103b30208 -[UIApplication _run] + 868 25 UIKitCore 0x103b33e80 UIApplicationMain + 124 26 SwiftUI 0x108a10524 0x107b8c000 + 15222052 27 SwiftUI 0x108a103c4 0x107b8c000 + 15221700 28 SwiftUI 0x108722088 0x107b8c000 + 12148872 29 MC Status 0x102506d30 static MCStatusApp.$main() + 40 30 MC Status 0x102506de0 main + 12 (MCStatusApp.swift:12) 31 dyld_sim 0x1028fd558 start_sim + 20 32 dyld 0x1026b1f28 start + 2236 33 ??? 0x3c15800000000000 ??? Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x102f1cfa8 __pthread_kill + 8 1 libsystem_pthread.dylib 0x10285712c pthread_kill + 256 2 libsystem_c.dylib 0x1801375ec abort + 104 3 libc++abi.dylib 0x180263c78 abort_message + 128 4 libc++abi.dylib 0x180255198 demangling_terminate_handler() + 300 5 libobjc.A.dylib 0x180037bf0 _objc_terminate() + 124 6 libc++abi.dylib 0x180263150 std::__terminate(void (*)()) + 12 7 libc++abi.dylib 0x180263100 std::terminate() + 52 8 libdispatch.dylib 0x180143d50 _dispatch_client_callout + 36 9 libdispatch.dylib 0x180152b24 _dispatch_main_queue_drain + 1272 10 libdispatch.dylib 0x18015261c _dispatch_main_queue_callback_4CF + 40 11 CoreFoundation 0x1803c61b4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 12 CoreFoundation 0x1803c08cc __CFRunLoopRun + 1936 13 CoreFoundation 0x1803bfd28 CFRunLoopRunSpecific + 572 14 GraphicsServices 0x189864bc0 GSEventRunModal + 160 15 UIKitCore 0x103b30208 -[UIApplication _run] + 868 16 UIKitCore 0x103b33e80 UIApplicationMain + 124 17 SwiftUI 0x108a10524 0x107b8c000 + 15222052 18 SwiftUI 0x108a103c4 0x107b8c000 + 15221700 19 SwiftUI 0x108722088 0x107b8c000 + 12148872 20 MC Status 0x102506d30 static MCStatusApp.$main() + 40 21 MC Status 0x102506de0 main + 12 (MCStatusApp.swift:12) 22 dyld_sim 0x1028fd558 start_sim + 20 23 dyld 0x1026b1f28 start + 2236
Posted
by
Post not yet marked as solved
0 Replies
459 Views
I work on an Apple Watch app that can preview what the iPhone camera sees, as well as controls it. I had one report of video quality seen on watchOS, both in resolution and FPS. The only time I've been able to reproduce this is with the "poor network quality" preset in the network link conditioner. Does this mean that the quality of the user's Wi-Fi connection is affecting their WatchConnectivity transfers?
Posted
by
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
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