"dyld: Symbol not found" crash when I run my app using Xcode 14 because can't find CGRect.divided(...)

I'm getting a crash when I try to run my app using Xcode 14. From the console:

dyld[21862]: Symbol not found: _$sSo6CGRectV12CoreGraphicsE9__divided5slice9remainder10atDistance4fromySpyABG_AiC7CGFloatVSo0A4EdgeVtF

  Referenced from: **path to my framework**

  Expected in: /usr/lib/swift/libswiftCoreGraphics.dylib

The code that causes crash is:

keyLabel.frame = bounds.divided(atDistance: labelHeight, from: .maxYEdge).slice

It seems it can't find that CGRect function.

Additional info: I'm on macOS 12.4 and was running my app in mac-catalyst mode. The crash doesn't happen when I run it inside an iPad simulator. But crashes when I run it on my iPad Pro (with iPadOS 15.5). Everything works fine on Xcode 13.4.

Answered by Frameworks Engineer in 716799022

Thanks for reporting. We're tracking this bug. It's an issue with deploying to previous OS versions. In the meantime, testing your app on macOS Ventura or iOS 16 should not crash.

Accepted Answer

Thanks for reporting. We're tracking this bug. It's an issue with deploying to previous OS versions. In the meantime, testing your app on macOS Ventura or iOS 16 should not crash.

I have a similar problem. With another symbol from CoreGraphics library. I'm building an iOS app and it crashes in iOS 15.5 Simulator when built with Xcode 14. Working fine on iOS 16 Simulator or when built with Xcode 13.4.1.

This appears to be fixed in Xcode 14.0 beta 2. I had to clean my build folder for it to start working though.

dyld: Library not loaded: /usr/lib/swift/libswiftCoreGraphics.dylib  Referenced from: /var/containers/Bundle/Application/B5B2939D-3DDA-457D-8F72-A79EFB417C60/xxxx.app/xxxx  Reason: image not found (lldb) 

Version 14.0 (14A309). Error still reported

Crash in the following versions: iOS 12.01 iOS 12.1.2

This looks like a very different issue. I recommend that you start a new thread with the details, including (at least) the Swift and Debugging.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

dyld: Library not loaded: /usr/lib/swift/libswiftCoreGraphics.dylib  Referenced from: /var/containers/Bundle/Application/xxxxxx/xxxxx.app/xxxxx  Reason: image not found

I have a similar problem below iOS12.2 , how to fix?

"dyld: Symbol not found" crash when I run my app using Xcode 14 because can't find CGRect.divided(...)
 
 
Q