iOS app crashes on iOS 9 after implementing the Urban Airship SDK
Recently, I implemented the Urban Airship SDK into an iOS app.
The main feature in the latest SDK was the added support for iOS Rich Notifications and content extensions (for iOS 10+).
Every time I ran the app on iOS 9, the app would crash and I would get the following error in the console:
dyld: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/UserNotifications
Referenced from: /Users/danielalbu/Library/Developer/Xcode/DerivedData/ios3-gkxrspxqytmnidfcmsabmlpwfqib/Build/Products/Debug-iphonesimulator/AirshipAppExtensions.framework/AirshipAppExtensions
Reason: image not found
(lldb)
It’s quite noticeable that the main issue is that UserNotifications.framework isn’t loaded.
Given that it’s an iOS 10 feature, it’s understandable why it won’t be available on iOS 9, but the question was: why is Urban Airship SDK trying to load an iOS 10 specific API on iOS 9?
Another look at the error shows us that AirshipAppExtensions.framework is the source of the call to the UserNotifications framework, so I went to the target settings -> General -> Linked Frameworks and Libraries and there I set the status of AirshipAppExtensions.framework to Optional (instead of Required):
Optional linking is useful if you're targeting older OS versions where a certain framework might not be available yet, which is exactly our case...
But that didn’t help.
The app was still crashing!
I remembered that during the implementation of the SDK, the AirshipAppExtensions framework was imported as a standalone project, which means that it is compiled locally during the compilation of my app.
I went and reviewed the Build Settings of that project and I saw that the iOS Development Target was set to iOS 10.
It was something that was configured automatically once I imported the project into XCode, so given that it’s not documented in the Urban Airship documentation I didn’t give it a second though upon importing.
So, I changed the iOS Development Target to iOS 9 and voilà, the app doesn’t crash on iOS 9 anymore:
[Update: October 31st, 2017]: The SVP Product & Engineering at Urban Airship was kind enough to inform me that the docs were updated and clarified according to my feedback: https://twitter.com/mherrick66/status/925411303363051521















