[iOS] dyld - it loads a framework with a higher minimum OS support

Our app supports iOS12 as the minimum OS and we embed a framework with iOS15 minimum support. Naturally we weak-link it and use #available(iOS 15, ) to guard accesses to its symbols.

On iOS12.5.7 the framework is completely ignored and the app works fine. On iOS13.3.1 however we get to see this error:

  Termination Description: DYLD, dependent dylib '/System/Library/Frameworks/AVFAudio.framework/AVFAudio' not found for '/private/var/containers/Bundle/Application/08DA2D93-4DC2-4523-98AF-FD52884989AE/<OUR_APP>.app/Frameworks/<FRAMEWORK>.framework/<FRAMEWORK>', tried but didn't find: '/System/Library/Frameworks/AVFAudio.framework/AVFAudio' '/System/Library/Frameworks/AVFAudio.framework/AVFAudio'

<FRAMEWORK> has a dependency on AVFAudio which is available only since iOS 14.5 so it makes sense it wouldn;t be able to find it but what's bothering us is why does dyld even try loading the <FRAMEWORK>'s dependencies instead of just ignoring it?

Could this be a bug on 13.3.1? Unfortunately at this time we don't have other iOS13 phones to test with.

The 'LC_BUILD_VERSION' command sure enough seems valid::

Load command 10 cmd LC_BUILD_VERSION cmdsize 32 platform 2 minos 15.0 sdk 17.0 ntools 1 tool 3 version 1015.7

Unfortunately at this time we don't have other iOS 13 phones to test with.

Do you have an iOS 14 device to try this on?

Share and Enjoy

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

Hi @DTS Engineer , no unfortunately we don't have one right now. We are trying to find unopened iPhone 12 / iPhone 11 devices to buy, to have them in their initial iOS14/iOS13 state but most of the stores so far are out of stock.

Does factory resetting iPhones put them in their original OS version?

I suspect you're hitting an issue with how we link the AVFAudio framework on a narrow range of iOS versions, so that's likely why you see things correctly ignored for your app on iOS 12, but not iOS 13. I suspect you'll see this crash on versions of iOS 14 prior to iOS 14.5 too.

We'd appreciate a bug report on that. If you can create a small test project where you have a framework with a deployment target of iOS 15, and app target of something older, and just a small amount of AVFAudio code in the framework to demonstrate the crash, that's even better. If you can file that report, please post the FB number here.

If I'm correct about the root cause of what you're seeing, the workaround is to raise the deployment target of the app to iOS 14.5 or above.

— Ed Ford,  DTS Engineer

[iOS] dyld - it loads a framework with a higher minimum OS support
 
 
Q