App crashes only watchOS 6 before launching

Here's what happens:

  • I install the app by updating the iOS companion app (debugging does not seem to work on Xcode 14)
  • I launch the app, the spinner around the app icon is shown
  • The app crashes and closes
  • The crash reports are empty

I have an app that runs back to watchOS 6, in an update in November I introduced something that now causes a crash on watchOS 6. That was also the first update I uploaded with the watchOS 9 SDK. It took me a while to get hold of an Apple Watch Series 2, since the issue is not reproducible in the watchOS simulator.

I guess that some library is loaded that should not be loaded. I verified all linked frameworks and all those which are not available on watchOS 6, are marked as weak.

Here's the crash report that I can get on the connected iPhone:

{"bug_type":"109","os_version":"Watch OS 6.3 (17U208)","build_version":"1","timestamp":"2023-05-05 03:48:22.00 +0200","app_name":"... WatchKit Extension","bundleID":"xyz.redacted....","incident_id":"65713574-8B62-460F-B888-5883BE6E722E","name":"... WatchKit Extension","is_first_party":0,"app_version":"3.0","share_with_app_devs":1,"slice_uuid":"d19f4d3c-f36f-342a-a5df-55697c51b6c7","adam_id":0}
Incident Identifier: 65713574-8B62-460F-B888-5883BE6E722E
CrashReporter Key:   a35b48fb320eafcf397ca73c04d9c4c855507a00
Hardware Model:      Watch2,4
Process:             ... WatchKit Extension [894]
Path:                /private/var/containers/Bundle/Application/2E5E3894-A93C-412C-A518-7B3C73B42E61/... WatchKit App.app/PlugIns/... WatchKit Extension.appex/... WatchKit Extension
Identifier:          xyz.redacted.....watchkitapp.watchkitextension
Version:             1 (3.0)
Code Type:           ARM (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           xyz.redacted.....watchkitapp.watchkitextension [438]


Date/Time:           2023-05-05 03:48:22.0871 +0200
Launch Time:         2023-05-05 03:48:21.0000 +0200
OS Version:          Watch OS 6.3 (17U208)
Release Type:        User
Baseband Version:    n/a
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x89248914
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [894]
Highlighted by Thread:  0

Backtrace not available

Unknown thread crashed with ARM Thread State (32-bit):
    r0: 0x62070f70    r1: 0x20ac4f70      r2: 0x82b13dc1      r3: 0x00000000
    r4: 0x62070f70    r5: 0x0015c000      r6: 0x27ca7224      r7: 0x27ca6288
    r8: 0x890ec914    r9: 0x01810034     r10: 0x27ca6390     r11: 0x0180efe0
    ip: 0x0180ef98    sp: 0x27ca6250      lr: 0x01b8b385      pc: 0x01b8b386
  cpsr: 0x00000030

Binary images description not available

Error Formulating Crash Report:
Failed to create CSSymbolicatorRef - corpse still valid ¯\_(ツ)_/¯

EOF

Best,
Alex

Answered by AlexSFD in 753703022

This was a crash caused by Xcode 14.3. When compiling with 14.3 and using Objective-C protocols in Swift the produced binary could not run on watchOS 6 and iOS 13. The solution here is to use Xcode 14.3.1, which fixes the bug.

Since that crash report isn't very revealing, I'll take a wild stab and ask whether you're using a third-party library/framework, perhaps, that isn't 32-bit safe? Simulators run in the address space of the Mac they're running on, which means all simulators on M1/M2 Macs (is that what you are using?) are 64-bit. Series 2 watches, however, are armv7k (32-bit).

Accepted Answer

This was a crash caused by Xcode 14.3. When compiling with 14.3 and using Objective-C protocols in Swift the produced binary could not run on watchOS 6 and iOS 13. The solution here is to use Xcode 14.3.1, which fixes the bug.

App crashes only watchOS 6 before launching
 
 
Q