When using different Frameworks
in Xcode, the compiler and linker sometimes do not include that Framework
in the library. The result is an immediate crash during the startup with the following message:
dyld: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/UserNotifications
Referenced from: /var/containers/Bundle/Application/1D41BD68-9B88-4D5D-B7AB-0D1C31979964/App.app/App
Reason: image not found
I found one way to avoid this. Its just mentioning the parts of that library within the apps code directly like this:
UNNotificationRequest *unr = [UNNotificationRequest alloc];
Just including a file from that framework with #include <UserNotifications/UserNotifications.h>
does not fix it. Nor does @import UserNotifications;
I have seen it with different libraries on different xcode versions for different ios versions.
Here are two other issues that have a more specific use case:
1) CABTMidiCentralViewController used in Storyboard only working if using code reference
2) Switching to Xcode 10 causes `UserNotifications.framekwor dyld: Library not loaded crash` for iOS9
Does anybody know why this is happening? And how to avoid that dumb part of code but still link / embed the desired framework?
P.S.
- I have set
Always Embed Swift Standard Libraries
toYES
- I have set
Link Frameworks Automatically
toYES
Update #1
The issue with the UserNotifications
framework:
iOS9 & XCode 9 - WORKS
iOS9 with XCode 10 - CRASH
Using the simulator:
Using a real device:
Update #2
It is not crashing when I change the framework from Required
to Optional
but then the push notifications are not working.