Post not yet marked as solved
Problem:
SwiftUI render wrong size on old device like Apple Watch Series 4.
The height was be cut, not well render as series 6 or simulator.
Check the screenshots.
BTW:
But it works well both on watch series 6 real device or simulator.
Reproduce:
Download “Build a Workout App for Apple Watch”, run the code on a real device of watch series 4
https://developer.apple.com/videos/play/wwdc2021/10009/
On Watch4-44 mm (first line be clip)
On Simulator or watch 6.
Post not yet marked as solved
I collect a lot of crash logs seem like this, but it seems that users are not affected by these crashes.
How it happened? I find a clue about this,
libAXSpeechManager.dylib			 0x6e31adbc -[AXSpeechThread main] + 368 (AXSpeechThread.m:50)
All crashes has Text to Speech function. my related code:
func speak(_ announcement: String,preDelay:TimeInterval = 0, endDelay:TimeInterval = 0,lan:String = "", rate:Float = AVSpeechUtteranceDefaultSpeechRate,didFinish:((_ str:String)->Void)? = nil) {
DispatchQueue.global(qos: .background).async {
let utterance = AVSpeechUtterance(string: announcement.lowercased())
utterance.volume = 2.0
if(lan.count > 0){
utterance.voice = AVSpeechSynthesisVoice(language:lan)
}
utterance.preUtteranceDelay = preDelay
utterance.postUtteranceDelay = endDelay
utterance.rate = rate
if let callback = didFinish {
self.synth.speakUtterance(utterance){
synth,utt in
callback("\(utt.speechString)")
}
} else {
self.synth.speak(utterance)
}
}
}
AVSpeechSynthesizer in watchOS seems easy to cause bugs.
Any suggest ? Thank you for help.
Incident Identifier: 235EFDB7-B276-4EA6-9FA8-4D624017F1EA
CrashReporter Key:	 a52074c6e7cd936048b907e2e6eec067f1578b41
Hardware Model:			Watch2,6
Process:						 YaoYao WatchKit Extension [408]
Path:								/private/var/containers/Bundle/Application/0841E854-BF20-4E7A-8BB0-5FB99B3F289D/YaoYao WatchKit App.app/PlugIns/YaoYao WatchKit Extension.appex/YaoYao WatchKit Extension
Identifier:					hltek.YaoYao.watchkitapp.watchkitextension
Version:						 2 (2.2.7)
AppVariant:					1:Watch2,6:6
Code Type:					 ARM (Native)
Role:								Non UI
Parent Process:			launchd [1]
Coalition:					 hltek.YaoYao.watchkitapp.watchkitextension [423]
Date/Time:					 2020-06-14 08:40:35.2580 +0800
Launch Time:				 2020-06-14 08:38:42.0000 +0800
OS Version:					Watch OS 6.2.5 (17T608)
Release Type:				User
Baseband Version:		n/a
Report Version:			104
Exception Type:	EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:	EXC_CORPSE_NOTIFY
Termination Reason: CAROUSEL, Snapshot watchdog transgression. Exhausted CPU time allowance of 2.00 seconds. Elapsed total CPU time (seconds) 6.22 (user 6.22, system 0.00), 60% CPU. Elapsed application CPU time (seconds) 2.48, 25% CPU.
Termination Description: SPRINGBOARD, CSLSceneSnapshotAction watchdog transgression: xpcservice<hltek.YaoYao.watchkitapp.watchkitextension>:408:408 exhausted CPU time allowance of 2.00 seconds | <FBExtensionProcess: 0x15ad8e90; xpcservice<hltek.YaoYao.watchkitapp.watchkitextension>:408:408; typeID: com.apple.watchkit> Elapsed total CPU time (seconds): 6.220 (user 6.220, system 0.000), 62% CPU | Elapsed application CPU time (seconds): 2.484, 25% CPU, lastUpdate 2020-06-14 00:40:29 +0000
Triggered by Thread:	0
Thread 0 name:
Thread 0 Crashed:
0	 libsystem_kernel.dylib				 0x4243b6f8 semaphore_wait_trap + 8
1	 libdispatch.dylib						 0x422f7188 _dispatch_sema4_wait + 12 (lock.c:139)
2	 libdispatch.dylib						 0x422f7612 _dispatch_semaphore_wait_slow + 104 (semaphore.c:132)
3	 FrontBoardServices						 0x45a4f576 -[FBSSceneSnapshotRequestHandle performRequestForScene:] + 418 (FBSSceneSnapshotRequestHandle.m:67)
4	 FrontBoardServices						 0x45a53b5c -[FBSSceneSnapshotAction snapshotRequest:performWithContext:] + 218 (FBSSceneSnapshotAction.m:168)
5	 FrontBoardServices						 0x45a0f070 -[FBSSceneSnapshotRequest performSnapshotWithContext:] + 276 (FBSSceneSnapshotRequest.m:65)
Thread 6 name:
Thread 6:
0	 libsystem_kernel.dylib				 0x4243b6a8 mach_msg_trap + 20
1	 libsystem_kernel.dylib				 0x4243ad7a mach_msg + 42 (mach_msg.c:103)
2	 CoreFoundation								 0x4277a4a0 __CFRunLoopServiceMachPort + 106 (CFRunLoop.c:2575)
3	 CoreFoundation								 0x4277649a __CFRunLoopRun + 1026 (CFRunLoop.c:2931)
4	 CoreFoundation								 0x42775dfc CFRunLoopRunSpecific + 326 (CFRunLoop.c:3192)
5	 Foundation										 0x43057a58 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 180 (NSRunLoop.m:374)
6	 libAXSpeechManager.dylib			 0x6138adbc -[AXSpeechThread main] + 368 (AXSpeechThread.m:50)
7	 Foundation										 0x43158308 NSThreadstart__ + 708 (NSThread.m:724)
8	 libsystem_pthread.dylib			 0x424c9236 _pthread_start + 130 (pthread.c:896)
9	 libsystem_pthread.dylib			 0x424cff50 thread_start + 20
[crash 1](https://developer.apple.com/forums/content/attachment/e45cca8c-69bf-4c9a-adef-2f42458844e7){: .log-attachment}
Post not yet marked as solved
There are many crash logs collected when fire a local custom notification on watchOS.
But everything works fine in both real device and simulator tests.
Any suggestion thanks.
WatchKit: -[SPRemoteInterface registerInterfaceController:interfaceControllerID:interfaceControllerClientID:applicationRootController:] + 268
Exception Type: EXCCRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXCCORPSENOTIFY
Triggered by Thread: 0
Related LevelUpNotificationController code:
class LevelUpNotificationController: WKUserNotificationInterfaceController {
@IBOutlet var lblLvl: WKInterfaceLabel!
override init() {
super.init()
}
override func willActivate() {
super.willActivate()
}
override func didDeactivate() {
super.didDeactivate()
}
override func didReceive(_ notification: UNNotification, withCompletion completionHandler: @escaping (WKUserNotificationInterfaceType) -> Swift.Void) {
print(">>> didReceive withCompletion")
let userInfo = notification.request.content.userInfo
if let lvl = userInfo["level"] as? Int {
self.lblLvl.setText("\(lvl)")
}
completionHandler(.custom)
}
@available(watchOSApplicationExtension 5.0, *)
override func didReceive(_ notification: UNNotification) {
super.didReceive(notification)
os_log(">>>didReceive: LevelUpNotificationController didReceive")
let userInfo = notification.request.content.userInfo
WKInterfaceDevice().play(.notification)
if let lvl = userInfo["level"] as? Int {
self.lblLvl.setText("\(lvl)")
}
}
}
crash log - https://developer.apple.com/forums/content/attachment/45d08ff4-51b5-44cc-a821-2f960d25174d
Post not yet marked as solved
Here is the bug report. I think it's a bug of watchOS 6 something related to apple Text to Speech service.When i not use tts, it's go away.Incident Identifier: 3C86B3F2-0565-464C-921C-A0ECB63237EBCrashReporter Key: 9de6d125d2514512fa87c39b4cc898e09cf8d8ccHardware Model: Watch4,4Process: LeanWatchApp Extension [367]Path: /private/var/containers/Bundle/Application/D8EC0163-C8EA-4375-B556-3C751744EEE3/LeanWatchApp.app/PlugIns/LeanWatchApp Extension.appex/LeanWatchApp ExtensionIdentifier: hltek.Lean.watchkitapp.watchkitextensionVersion: 4 (1.15)Code Type: ARM (Native)Role: ForegroundParent Process: launchd [1]Coalition: hltek.Lean.watchkitapp.watchkitextension [473]Date/Time: 2019-10-08 08:45:38.1157 +0800Launch Time: 2019-10-08 08:42:38.0000 +0800OS Version: Watch OS 6.0.1 (17R605)Release Type: UserBaseband Version: Report Version: 104Exception Type: EXC_BAD_ACCESS (SIGSEGV)Exception Subtype: KERN_INVALID_ADDRESS at 0x00000000195eb0c0VM Region Info: 0x195eb0c0 is not in any region. Bytes after previous region: 553153 Bytes before following region: 104714048 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL Stack 194dc000-19564000 [ 544K] rw-/rwx SM=COW thread 5---> GAP OF 0x6464000 BYTES unused shlib __TEXT 1f9c8000-1f9ee000 [ 152K] r-x/r-x SM=COW ... this processTermination Signal: Segmentation fault: 11Termination Reason: Namespace SIGNAL, Code 0xbTerminating Process: exc handler [367]Triggered by Thread: 0Thread 0 name: Dispatch queue: com.apple.main-threadThread 0 Crashed:0 libsystem_pthread.dylib 0x1fd6a670 pthread_get_qos_class_np + 81 Foundation 0x20adf988 -[NSThread qualityOfService] + 802 Foundation 0x20aa24e8 -[NSObject+ 271592 (NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 2723 Foundation 0x20aa43f4 -[NSObject+ 279540 (NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:] + 1164 libAXSpeechManager.dylib 0x437a88f0 -[AXSpeechManager isSpeaking] + 1125 libAXSpeechManager.dylib 0x437a3c38 -[AXSpeechManager _didBeginInterruption] + 526 libAXSpeechManager.dylib 0x437a3fec -[AXSpeechManager _handleAudioInterruption:] + 5007 CoreFoundation 0x200bb1d0 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 208 CoreFoundation 0x200bb218 ___CFXRegistrationPost1_block_invoke + 649 CoreFoundation 0x200ba580 _CFXRegistrationPost1 + 36810 CoreFoundation 0x200ba24c ___CFXNotificationPost_block_invoke + 10411 CoreFoundation 0x20037fec -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 139212 CoreFoundation 0x200b9bc8 _CFXNotificationPost + 118813 Foundation 0x20a694c0 -[NSNotificationCenter postNotificationName:object:userInfo:] + 6014 AVFAudio 0x2ac2048c -[AVAudioSession privateInterruptionWithInfo:] + 99215 AVFAudio 0x2ac22c30 (anonymous namespace)::HandlePropertyListenerCallback+ 597040 (unsigned int, objc_selector*, NSObject*) + 7216 libdispatch.dylib 0x1fb333a0 _dispatch_call_block_and_release + 2417 libdispatch.dylib 0x1fb34730 _dispatch_client_callout + 1618 libdispatch.dylib 0x1fb405a8 _dispatch_main_queue_callback_4CF + 99219 CoreFoundation 0x200dbe6c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 1220 CoreFoundation 0x200d6a10 __CFRunLoopRun + 74021 CoreFoundation 0x200d6420 CFRunLoopRunSpecific + 46422 GraphicsServices 0x236462ec GSEventRunModal + 10023 UIKitCore 0x3ca1f784 UIApplicationMain + 176024 libxpc.dylib 0x1fdc4aa4 _xpc_objc_main.cold.3 + 20825 libxpc.dylib 0x1fdb0a90 _xpc_objc_main + 21226 libxpc.dylib 0x1fdb33e4 xpc_main + 15227 Foundation 0x20aa663c +[NSXPCListener serviceListener] + 028 PlugInKit 0x298462f8 0x2982d000 + 10316029 WatchKit 0x325c4f94 WKExtensionMain + 6030 WatchKit 0x325c4fb8 main + 1231 libdyld.dylib 0x1fb70a38 start + 4It's very similar to this: App is getting crashed on app launch in iOS 13 beta versionWhen make wrist down , the watch screen off ,It always crash. but my app is Workout app, it can work in background before watchOS 6.