I have an Xcode project, Xcode 8.1 (8B62) with two targets, one for the paid version of the application and the other for the free version. They both manage remotes push notifications. Since I made the changes for iOS 10 with the new framework UNUserNotificationCenter.framwork, everything is fine for the first target and I have a link error for the second. It worked well under iOS 9 with the old methods. What I did for both targets:
It's the same code for both targets.
Unfortunately, for the second target, I have the following error:
Undefined symbols for architecture arm64: "_OBJC_CLASS _ $ _ UNUserNotificationCenter", referenced from: Objc-class-ref in AppDelegate.o Ld: symbol (s) not found for architecture Clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have done several times clean and clean build target folder, re-start Xcode, re-start the computer but nothing is done.
Nothing found in the different forums ...
Help would be welcome. Thank you in advance.
You are not linking to the UserNotifications.framework
.
UserNotifications.framework
exists in "Link Binary With Libraries"If it does not:
I had almost exactly the same problem, with two targets, one for the free version, one for the paid version.
I strongly suspect that the difference was that with one target, "Enable modules" was YES (this was the target for the free version, where I was doing an @import for Admob), whereas with the other target, "Enable modules" was NO. Like magic, I didn't have to add UserNotifications.framework in "Link Binary with Libraries" in Build Phases for the target where "Enable modules" was YES. However, for the target where "Enable modules" was NO, I got
Undefined symbols for architecture arm64: "_OBJC_CLASS _ $ _ UNUserNotificationCenter
and it went away by manually adding UserNotifications.framework to "Link Binary with Libraries".
So maybe the rule is, this needs to be done if and only if modules are not enabled.
Make sure UserNotifications.framework
exists in your Target > General > Linked Frameworks and Libraries
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With