SDWebImage / SDWebImageLinkPlugin

A SDWebImage loader plugin, to support load rich link image with LinkPresentation framework
MIT License
17 stars 2 forks source link

'dyld: Library not loaded' error in iOS versions pre-iOS13 #14

Closed inPhilly closed 4 years ago

inPhilly commented 4 years ago

Most frameworks can be marked as optional so as not to throw errors in iOS versions that are not supported by the framework.

This framework is throwing the following error in iOS 12, even when marked as 'Optional'.

dyld: Library not loaded: /System/Library/Frameworks/LinkPresentation.framework/LinkPresentation Referenced from: /Users/home/Library/Developer/CoreSimulator/Devices/CX6B02F4-0X8B-46DF-8X20-5A3AB2XC0CA2/data/Containers/Bundle/Application/30FX24EA-30X4-42X5-8X75-A4085A0CED75/MyApp.app/Frameworks/SDWebImageLinkPlugin.framework/SDWebImageLinkPlugin Reason: no suitable image found. Did find: /System/Library/Frameworks/LinkPresentation.framework/LinkPresentation: mach-o, but not built for iOS simulator

I have the LinkPresentationFramework included and marked as 'Optional', and when I remove the SDWebImageLinkPlugin (leaving the LinkPresentationFramework) , there is no error. But as soon as I include the SDWebImageLinkPlugin, even though it is also marked as 'Optional', I get the above error.

dreampiggy commented 4 years ago

This framework current does not keep the back-deployment available. To solve this, we must declare all the public API with this style:

- (void)foo API_AVAILABLE(ios(13.0), mac(10.15));

And we need to use -weak_framework linker flags or Weak Framework to link Apple's LinkPresentation.framework. Currently it does not. So dyld will assume we require the LinkPresentation in runtime.

This can be a feature request, I'll add soon.

dreampiggy commented 4 years ago

Should be solved by 0.3.0 version

You can check the latest readme about the Backward Deployment. This knowledge applied to any Apple's framework.