Switching to Xcode 10 causes `UserNotifications.fr

2019-03-06 22:17发布

问题:

We have an app that is working properly with the UserNotification.framework being linked as required framework in Xcode 9. Everything works smooth here.

Now we are switching to Xcode 10. But there linking this framework as required leads to

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

If I switch it to optional push notification (via Intercom) won't work anymore.

What is the reason? How can we fix that? Why is it even working in Xcode 9?

Update #1

using

@import UserNotification

does not fix it

Update #2

Its fixed by importing and using it actually (in AppDelegate.m) like this

UNNotificationRequest* unr = [UNNotificationRequest alloc];
unr = nil;

Why?

It is related to the same issue I have experienced already.

CABTMidiCentralViewController used in Storyboard only working if using code reference

Update #3

More generic question

Xcode sometimes removes linked library

回答1:

UserNotification SDK is available on iOS 10+, Try to update the deployment Target to iOS 10 +



回答2:

Can your please try removing the framework and adding that again ? I just created a new project this framework added in Xcode 10 and was able to run in the device without any errors.