Post

Replies

Boosts

Views

Activity

HKWorkoutSession.sendToRemoteWorkoutSession doesn't report success or failure
We are seeing an issue where sending data using the asynchronous method HKWorkoutSession.sendToRemoteWorkoutSession(data: Data) will never return in some cases (no success nor failure). This issue is happening for roughly 5% of Workouts started and will stay broken for the whole workout. The other 95% of the workouts, the connection works flawlessly. This happens on both watchOS 10 and 11, and with phones running iOS 17 or 18. The issue is quite random and not reproducible. Our app has thousands of workouts a day that use the workout session workout data send, with constant messages being send every few seconds. In some of those 5% cases the "sendToRemoteWorkoutSession" will throw way later, like 30+ minutes later, if the watch app is awake long enough to capture a log of a failure. Our code uses the same flow as in the sample project: https://developer.apple.com/documentation/healthkit/workouts_and_activity_rings/building_a_multidevice_workout_app Here is some sample code, which is pretty simple. Setup code: let workoutSession = try HKWorkoutSession(healthStore: healthStore, configuration: configuration) workoutSession.delegate = self activeWorkoutSession?.startMirroringToCompanionDevice { success, error in print("Mirroring started on companion device: \(success), error: \(error)") } workoutSession?.prepare() then later we send data using the workout session: do { print("Will send data") try await workoutSession.sendToRemoteWorkoutSession(data: data) print("Successfully sent data") // This nor the error may be called after waiting extensive amounts of time } catch { print("Failed to send data, error: \(error)") // This nor the success may be called after waiting extensive amounts of time } So far, the only fix is to restart the phone and watch at the same time, which is not a great user experience. Is anyone else seeing this issue? or know how to fix this issue?
0
0
21
1h
Is there a way to know if an App is supported on the paired Apple Watch?
We would like to tell a user that we have an Apple Watch app in our iOS app but we don't want to uses that have an Apple Watch paired that is not supported. We can look at WCSession.default.isPaired to know that some kind of watch is paired, and we can use WCSession.default.isWatchAppInstalled to know that our app is not installed on the watch. Although we want to know if the watch is even supported. Example: A user has an Apple Watch Series 3 paired, but our app only supports watchOS 9. How do we avoid telling that user about an our app that they are not even able to install on that watch?
0
0
609
Apr ’23
Why does a MainActor class / function not run on Main Thread?
When marking the ViewController and the function with @MainActor, the assertion to check that the UI is updated on main thread fails. How do I guarantee that a function is run on Main Thread when using @MainActor? Example code: import UIKit @MainActor class ViewController: UIViewController {     let updateObject = UpdateObject()     override func viewDidLoad() {         super.viewDidLoad()                  updateObject.fetchSomeData { [weak self] _ in             self?.updateSomeUI()         }     }     @MainActor     func updateSomeUI() {         assert(Thread.isMainThread) // Assertion failed!     } } class UpdateObject {     func fetchSomeData(completion: @escaping (_ success: Bool) -> Void) {         DispatchQueue.global().async {             completion(true)         }     } } Even changing DispatchQueue.global().async to Task.detached does not work. Tested with Xcode 13.2.1 and Xcode 13.3 RC
5
0
2.8k
Mar ’22
Playing a video on the watch app changes the audio route on iOS
Attempting to play a video using WKInterfaceInlineMovie will cause the audio route to change on the iPhone, causing music and other audio to pause. This happens when using AirPods with an iPhone when an Apple Watch is connected. Does anyone know how to fix this? I have also tried setting the AVAudioSession category on the watch, but the output still gets taken from the iOS device. There is no audio on the video nor am I interested in playing any audio from the watch.
0
0
839
Feb ’21
Accessing a NWListener shortly after starting and with "Local Network" denied, causes "_os_unfair_lock_corruption_abort" Crash
This works fine when the local network permissions are allowed but not when the permission is denied. Simply trying to print or set the newConnectionHandler to nil on the listener will result in a crash. Does anyone know why this happens? Crash: Exception Type:	EXC_BREAKPOINT (SIGTRAP) Exception Codes: 0x0000000000000001, 0x00000001e6cd3234 Termination Signal: Trace/BPT trap: 5 Termination Reason: Namespace SIGNAL, Code 0x5 Terminating Process: exc handler [50016] Triggered by Thread:	0 Thread 0 name: Thread 0 Crashed: 0	 libsystem_platform.dylib			 0x00000001e6cd3234 _os_unfair_lock_corruption_abort + 36 (lock.c:524) 1	 libsystem_platform.dylib			 0x00000001e6cd1164 _os_unfair_lock_lock_slow + 320 (lock.c:575) 2	 libnetwork.dylib							 0x00000001a070e02c nw_listener_set_new_connection_handler + 92 (listener.m:128) 3	 (setting newConnectionHandler to nil) Note that we have already added NSLocalNetworkUsageDescription and a NSBonjourServices tcp We see that we are unable to check the status of the Local Network permissions but maybe there is another way to mitigate getting the crash when trying to clear out our listener.
4
0
1.1k
Oct ’20
Static Library Symbols are missing from the bcsymbolmap
We are trying to symbolicate crashes that happen in our included static libraries but it appears that the symbols are removed. Does anyone know hoe to include the the bitcode symbols from a static library? I have tried many of the Build Settings and none seem to keep the symbols. Example from a bcsymbolmap with Kingfisher as the static library: _$s10Kingfisher0A17ParsedOptionsInfoV11targetCacheAA05ImageF0CSgvpMV __hidden#4023_ __hidden#4024_ __hidden#4025_ __hidden#4026_ __hidden#4027_ __hidden#4028_ _$s10Kingfisher16ImageProgressiveVMn __hidden#4029_ __hidden#4030_ __hidden#4031_ All the rest of the symbols for the rest of the codebase are present.
1
0
1.3k
Oct ’20
Unable to use NWBrowser on watchOS ?
I created a NWBrowser and when listening to the stateUpdateHandler callback, it always returns error "-65563: ServiceNotRunning". It indicates that the "Background daemon not running". Is there something else that needs to be set up in order for this to work, or is NWBrowser not actually available on watchOS? NSBrowser is listed as available on watchOS 6+, why would this not be able to used? https://developer.apple.com/documentation/network/nwbrowser
1
0
763
Jul ’20
Audio Airplay with Multiple AVPlayers
Our app uses multiple AVPlayers at once, some with video, and some with just audio. When trying to airplay it appears that only one of the AVPlayers can play at a time. Is there a setting for the Apple TV to just work as an external audio output rather than it attempting to play a particular AVPlayerItem. We would like all the audios to mix together. Screen Mirroring works ok, but we cant expect all our users to go through the process to enable that and some will select audio airplay.
2
0
975
Jul ’20
CoreML fails to import for Xcode 12 / watchOS 7 beta
CoreML fails to link and compile the build when trying to use any of its methods in a watchOS app. Error: Undefined symbols for architecture i386:   "_OBJC_CLASS_$_MLPredictionOptions", referenced from:       objc-class-ref in ExtensionDelegate.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation) Steps to reproduce: Create a new watchOS app Add import CoreML to ExtensionDelegate Add let _ = MLPredictionOptions() to ExtensionDelegate Attempt to compile the project Any assistance would be helpful!
1
0
932
Jul ’20