Hello all,
I have run into a weird situation in my watchOS app with a companion iOS app.
Issue: Watch fails to receive sendMessage string sent from phone while watch is in foreground. This is not consistent and seems to happen randomly under certain conditions.
Order of operations: User Opens phone app & watch app -> user presses "sendMessage" button, func is called -> watch does not receive message while in foreground
Condition explanation: To my knowledge, without a HealthKit workout session active, the apple watch is not available to receive messages (using any internal library transmission type) from its iOS companion app while the watch screen is not in the foreground (i.e. inactive). However, my issue is that sometimes, while the watch IS in the foreground, it does not receive the companion app's message. Additionally, this is not resolved by force quitting both iOS and watchOS apps. The only way I have gotten this issue to go away is by restarting both the phone and the watch. Again, it is not a consistent behavior and seemingly happens randomly. This behavior has been observed across multiple different beta testers on different hardware.
This is only apparent when transmitting from Phone -> Watch. I have not experienced any transmission issues when transmitting Watch -> Phone.
My team and I have speculated that it could be an issue with WCSession.isReachable returning true before we transmit the message but changing to false before the hardware actually transmits. However, this wouldn't explain why the watch would not be available while in the foreground. This is just a preliminary thought.
My goal in posting on here is to see if anyone else has experienced this, or if it's a known bug.
All message protocols have been coded to follow Apple's WCSession documentation as closely as possible.
Hardware specs:
Watch Model: A2093 (series 5)
WatchOS ver: 10.6.1
Phone: MU693LL/A (15 pro max)
iOS ver: 18.3.2
XCode ver: 16.0
WatchKit
RSS for tagBuild apps that leverage watchOS features like background tasks, extended runtime sessions, and access to the Digital Crown using WatchKit.
Posts under WatchKit tag
136 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
We have a watchOS app that provides many configurable widgets. Those widgets are configured and installed with help of AppIntent:
public struct RectComplAppIntent: AppIntent, WidgetConfigurationIntent, CustomIntentMigratedAppIntent {
@Parameter(title: "Style")
var style: String?
....
}
However when I print WidgetInfos with getCurrentConfigurations(), I sometimes got nil for configuration. At the same time widgets are not loaded. Exact steps:
User installs the pre-cofnigured .watchface.
Complications are not loaded since configuration is missing. I print getCurrentConfigurations() and get entries like this:
WidgetInfo:
- configuration: nil
- widgetConfigurationIntent: nil
- family: accessoryRectangular
- kind: Rectangle
Then user force-touches a face and opens editing mode. Returns to watch app, prints infos:
WidgetInfo:
- configuration: <INIntent: 0x780d290> {
style = vol1Logo;
}
- widgetConfigurationIntent: nil
- family: accessoryRectangular
- kind: Rectangle
– Suddenly intent appears with the correct style and complications start to show up.
How do you think, why it happens? Why after .watchface install all the WidgetInfo has nil intent (configuration)? What helps them to load later?
You can try this face yourself: https://cdn.watchfaces.co/watchfaces/glance-minimalist.watchface
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
WatchKit
watchOS
WidgetKit
App Intents
I'm working on a watchOS app that has an iOS counterpart. There will be a subscription required to unlock functionality and I would like the user to be able to make the purchase on either the iPhone or the watch and have both apps unlock.
The first link below says that StoreKit 2's Transaction.currentEntitlements will not work in this case like it does with extensions. The second link says it might work but doesn't in the sandbox.
What is the best way to make this work? Will it just work in the App Store? Should I use WCSession to send the purchase information from one platform to the other and store it in the keychain? Something else?
Via https://www.revenuecat.com/blog/engineering/ios-in-app-subscription-tutorial-with-storekit-2-and-swift/
"Transaction.currentEntitlements can be used in extensions the same way it was used in the previous steps. This works for extensions like Widgets and Intents. However, an iOS app with a companion watchOS app will not work even though Transaction.currentEntitlements can be executed in it. A companion watch app does not stay updated with the same transaction history as its iOS app because they are separate platforms."
Via https://developer.apple.com/forums/thread/739963
"In TestFlight I was able to confirm that the Watch app and IOS app share in-app purchases. It seems the problems confirming this with Storekit and Sandbox are limits of the testing environments."
I have followed this video on implementing a custom view for the watchOS 11 Smart Stack Live Activities. However, the UI of my iOS app keeps showing up on the watchOS.
`struct widgetLiveActivity: Widget {
@Environment(.activityFamily) var activityFamily
var body: some WidgetConfiguration {
ActivityConfiguration(for: widgetAttributes.self) { context in
switch activityFamily {
case .small, _:
Text("WatchOS UI")
case .medium:
Text("iOS UI")
.activitySystemActionForegroundColor(Color.black)
} dynamicIsland: { context in ... }
.supplementalActivityFamilies([.small, .medium])
}
}`
Hi,
I'll start by saying that I'm a new developer for apps for Apple devices, especially for Apple Watch, so please have mercy
I'm trying to create an app for Apple Watch (WatchOs 10+) and I have a problem, my interface is made up of 3 buttons, one at the bottom of the screen and two smaller ones positioned on the top of the screen, each in their respective corners (one at the top right and the other at the top left).
By positioning these buttons on the top of the screen, the top right button is covered by the default Apple time, and I would like to move it to the center, thus creating two side buttons and the time in the center.
I'm also asking if there's a way to remove it since it's not useful to me, but reading some forums it seems that without it I don't pass the app verification, so I'm waiting for your advice.
The only app I've seen in circulation on the app store that has the centered clock is petey.
Apple Watch automatically tracks sleep data and syncs it to the iPhone, making it available through HealthKit for historical analysis. However, there is no way to retrieve real-time data on whether a user has entered sleep, or whether they are in a specific sleep stage at any given moment.
Is it possible to provide an interface for real-time sleep status monitoring
My app monitors users heart beats and if critical reading is noticed, it auto -dials 911 for emergency and ambulance help.
I was under the impression that auto-dial may not be permitted or possible on the platform.
Can anyone confirm and provide any additional guidance on if it is possible in the newer SDK/API stack or using any 3rd party service ?
Thank you in advance!!
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags:
Mobile Core Services
Watch Connectivity
WatchKit
We developed a camera remote control app for Apple Watch, but during the development process, we found that Apple Watch is prone to sleep on its own without screen interaction (usually automatically sleeping between 5s and 15s when there is no interaction, but our Apple Watch app actually receives the camera preview video frame data we transmit all the time, and there is no data interaction), and then triggers the sessionReachableDidChange function, and the session.isRechable is false. We hope that the camera remote control app for our Apple Watch can remain on when in the foreground, making it convenient to control our camera app on our phone. We found that DJI's Apple Watch app does not automatically sleep and does not sleep for more than 2 minutes. We have tried many methods, such as heartbeat packets, and I have added WKSupportsAlwaysOnDsplay to the Apple Watch info.plist file, but have not found an effective solution. I hope you can provide assistance, thank you.
I've made the code in xcode for apple watch with 2 swift view (contentView.swift and interfaceController.swift).The swift for sound and haptic feedback is in InterfaceController.swift. But the the sound does not appear with haptic feedback in apple watch after complete the xcode.
the app is done but no sound appear with haptic feedback when rotate apple watch digital crown. when crown rotated but sound appear
code
import WatchKit
import AVFoundation
import WatchKit
class InterfaceController: WKInterfaceController {
// ... your UI elements
func playSelectionHapticAndSound() {
// Play a haptic feedback pattern
WKInterfaceDevice.current().play(.success)
// Load and play a selection sound effect
guard let soundURL = Bundle.main.url(forResource: "spin", withExtension: "wav") else { return }
do {
let player = try AVAudioPlayer(contentsOf: soundURL)
player.play()
} catch {
print("Error playing sound: \(error)")
}
}
}
We have recently developed the iwatch app. We will package the APP + iwatch app and publish it in testfight for test download. However, we often find that after the mobile app is downloaded, the iwatch app is also on the iwatch System application inside display. Click install is always in the installation. It has not been installed. Especially when the phone we tested is paired with several watches. Or delete the mobile APP and download it again to recover. But some situations still cannot be recovered. May I ask why it is always installed? We have confirmed that there is no problem with the network, and the pairing connection between the watch and the mobile phone is normal. This problem has caused us a lot of trouble. I wonder if this will happen in the app store. Please give the official reply
Topic:
Developer Tools & Services
SubTopic:
Apple Developer Program
Tags:
WatchKit
watchOS
TestFlight
I am working on watch os project. I need to check network connectivity when user turn on and off the network.
I am using NWPathMonitor for check network availability. I am connected with wifi but it still showing unsatisfied not real device but it's working perfect on simulator.
Dear Apple Developer Support,
I am writing to request assistance with an ongoing issue I'm encountering while developing an iOS application that utilizes HealthKit to fetch heart rate data.
My goal is to display near real-time heart rate updates continuously same as displaying in the Apple Watch , I want to show in the iPhone Mobile Application for fitness related. I have implemented the following approaches:
HKSampleQuery with a Timer: I've set up a timer to periodically fetch the latest heart rate data.
Despite these efforts, I'm consistently facing the following problems:
Delayed Updates: The heart rate data displayed in the app often doesn't reflect the current heart rate being measured by the Apple Watch. There seems to be a significant synchronization delay.
Inconsistent Background Updates: Background updates, even with background app refresh enabled, are not reliable. The app often only updates when brought to the foreground or after being killed and relaunched.
Entitlements: The com.apple.developer.healthkit.background-delivery entitlement error is missing.
I have thoroughly reviewed Apple's HealthKit documentation, implemented best practices for HealthKit integration, and verified that all necessary permissions are properly configured.
I understand that HealthKit may not be designed for true real-time data, but the current level of delay and inconsistency is making it difficult to provide a useful user experience.
Could you please provide guidance on whether achieving near real-time heart rate updates continuously in an iOS app using HealthKit is possible? If so, what are the recommended strategies and best practices to overcome these limitations?
I have also tested the application on physical devices with Apple Watch, enabled background app refresh, granted permissions, and referred to HealthKit documentation.
I would appreciate any insights or suggestions you can offer to help resolve this issue.
Thank you for your time and assistance.
Sincerely,
Venu Madhav
I just created watchOS app alone a few months ago but I wanted to make a complication extension for my Apple Watch face. Without the aid of existing iOS app
When trying to use the watchOS preview the simulator fails to load and throws about 15 errors. Clearly the simulator is trying to load all of the iOS packages to the watchOS simulator. However, these packages clearly aren't included in the watchOS app. Furthermore, both apps build successfully to the main simulators, just not the previews. Having a list of errors that simply should not be there is a pretty big annoyance when something is going wrong. How do I fix this?
I have two standalone app written for watchos (standalone). One to authenticate and one for connectivity to real-world devices. The connectivity app uses the authentication app before every action, Im testing this with two xcode projects I have created and tried different things ended up with this error.
authapp://authenticate?callback=linkingapp://callback
-[SPApplicationDelegate extensionConnection:openSystemURL:]:2418: URL with scheme "authapp" not supported
how to get the url scheme working? Tested this in simulator and real device. info.plist and AppDelegate files are placed in both apps.
I am developing a watchOS app with a tab view, and inside one of the tabs, I have a 2x2 collection view layout. Each collection item contains a view that handles:
Tap Gesture (.onTapGesture) → Executes an action immediately.
Long Press Gesture (LongPressGesture) → Triggers an update when long press starts and again when it ends.
Drag Gesture (DragGesture) → Updates the position while dragging and resets values when the gesture ends.
Issue:
Most of the time, the gestures work correctly, but if another finger swipes on the screen while a long press is active, sometimes the onEnded event does not trigger, leaving the button in an active state.
Observations:
The onTapGesture executes normally without issues.
The LongPressGesture starts as expected, but if another finger interacts with the screen, the onEnded of the drag gesture does not always trigger.
This results in the button remaining visually or functionally "pressed" until another interaction occurs.
Has anyone encountered similar behavior in watchOS? How can I ensure that long press and drag gestures always complete even when another finger swipes on the screen?
Thanks in advance!
I get a crash in Apple Watch simulator (Series 9 45mm 18.0) as soon as the app launch if I type anything on external keyboard (just hitting command key for instance to capture a screenshot). Same crash on series 7 (45mm, OS 18.1)
But app works normally when I use mouse to interact with the app on simulator.
App does not crash on real device (Watch 4 OS 10.4.1).
Nor does it crash on Series 6 simulator (44 mm OS 17.4).
Here are the log I could collect (apparently, they contain sensitive language !!! so I attach as a file.:
Attached logs
There doesn't seem to be a background mode that will allow an iPhone app to run in the background in order to communicate with its watch app, which is running in the foreground on the watch. Have I missed something?
Related but not quite the same: say the iPhone app can run in the background to get location updates. But it only wants to do so when the watch app is running. Is there a way that the watch app can wake, or even start, the iPhone app, and for the iPhone app to then enable location updates?
(I have previously implemented Bluetooth background modes - I think I could achieve both of the above if I had the watch and the iPhone communicate using my own BTLE protocol, rather than using Watch Connectivity. Is this true?)
Topic:
App & System Services
SubTopic:
Core OS
Tags:
Watch Connectivity
WatchKit
Core Location
Apple Watch
I've got a watch app, still with storyboard, WKInterfaceController and WatchConnectivity.
After updating it for swift 6 concurrency I thought I'd keep it for a little while without swift 6 concurrency dynamic runtime check.
So I added -disable-dynamic-actor-isolation in OTHER_SWIFT_FLAGS, but it doesn't seem to have an effect for the Apple Watch target. Without manually marking callbacks where needed with @Sendable in dynamic checks seem to be in place.
swiftc invocation is as (includes -disable-dynamic-actor-isolation):
swiftc -module-name GeoCameraWatchApp -Onone -enforce-exclusivity\=checked ... GeoCameraWatchApp.SwiftFileList -DDEBUG -enable-bridging-pch -disable-dynamic-actor-isolation -D DEBUG -enable-experimental-feature DebugDescriptionMacro -sdk /Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS11.2.sdk -target arm64_32-apple-watchos7.0 -g -module-cache-path /Users/stand/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -Xfrontend -serialize-debugging-options -enable-testing -index-store-path /Users/stand/Library/Developer/Xcode/DerivedData/speedo-almhjmryctkitceaufvkvhkkfvdw/Index.noindex/DataStore -enable-experimental-feature OpaqueTypeErasure -Xcc -D_LIBCPP_HARDENING_MODE\=_LIBCPP_HARDENING_MODE_DEBUG -swift-version 6
...
-disable-dynamic-actor-isolation flag seems to be working for the iOS targets, I believe.
The flag is described here
Am I missing something? Should the flag work for both iOS and Apple Watch targets?
Hi all,
I’m developing a watchOS app that uses a WebSocket API to process voice audio. However, I keep encountering this error when trying to establish the connection:
nw_endpoint_flow_failed_with_error [C1 <server URL>:443 failed parent-flow (unsatisfied (Path was denied by NECP policy), interface: ipsec2, ipv4, ipv6, proxy)] already failing, returning
I’ve read Technical Note TN3135, which outlines an exception for audio streaming apps. My app is an audio streaming app, and I’ve already added background audio mode to the app’s capabilities. However, I’m not sure what else is required to meet the exception described in TN3135.
Questions
How do I meet the exception outlined in TN3135 for WebSocket audio streaming on watchOS?
Does NECP enforce additional restrictions even with background audio enabled, and how can I address this?
Any guidance or examples of implementing WebSocket audio streaming on watchOS would be greatly appreciated.
Thanks!