OneSignal OneSignalNotificationExtension build fail on Xcode 12 related to cocoapods / architecture / simulator issues
Description:
Just updated from Xcode 10 to Xcode 12, before on v10 this project built and run successful.
OneSignalNotificationExtension target build fail:
Undefined symbol: _swift_getObjCClassMetadata
Undefined symbol: type metadata accessor for Foundation.UUID
Undefined symbol: Swift._bridgeAnythingToObjectiveC<A>(A) -> Swift.AnyObject
Undefined symbol: protocol descriptor for Swift.ExpressibleByFloatLiteral
Undefined symbol: associated conformance descriptor for Swift.ExpressibleByFloatLiteral.Swift.ExpressibleByFloatLiteral.FloatLiteralType: Swift._ExpressibleByBuiltinFloatLiteral
Undefined symbol: associated type descriptor for Swift.ExpressibleByFloatLiteral.FloatLiteralType
Undefined symbol: protocol descriptor for Swift.ExpressibleByIntegerLiteral
Undefined symbol: associated type descriptor for Swift.ExpressibleByIntegerLiteral.IntegerLiteralType
Undefined symbol: method descriptor for Swift.ExpressibleByIntegerLiteral.init(integerLiteral: A.IntegerLiteralType) -> A
Undefined symbol: static Foundation.UUID._unconditionallyBridgeFromObjectiveC(__C.NSUUID?) -> Foundation.UUID
Undefined symbol: value witness table for Builtin.Int32
Undefined symbol: protocol witness table for Swift.Int : Swift._ExpressibleByBuiltinIntegerLiteral in Swift
and 100 errors more
I'm not so good on Xcode and Mac so I'm sorry if it's no clear or misleading.
Thank you
Environment
react-native 0.63.2 onesignal-react-native 3.9.1 Xcode 12 Installed via npm and linked with pods
Steps to Reproduce Issue:
- Build
Howdy,
What does your NotificationService.swift file look like? It should be something like:
import UserNotifications
import OneSignal
class NotificationService: UNNotificationServiceExtension {
var contentHandler: ((UNNotificationContent) -> Void)?
var receivedRequest: UNNotificationRequest!
var bestAttemptContent: UNMutableNotificationContent?
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
self.receivedRequest = request;
self.contentHandler = contentHandler
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
if let bestAttemptContent = bestAttemptContent {
OneSignal.didReceiveNotificationExtensionRequest(self.receivedRequest, with: self.bestAttemptContent)
contentHandler(bestAttemptContent)
}
}
override func serviceExtensionTimeWillExpire() {
// Called just before the extension will be terminated by the system.
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
OneSignal.serviceExtensionTimeWillExpireRequest(self.receivedRequest, with: self.bestAttemptContent)
contentHandler(bestAttemptContent)
}
}
}
Take a look at step 4.3.6 in the setup instructions and continue from there to ensure you've set up everything correctly.
Hope this helps. Cheers
Thanks for the feedback.
I'm using the Objective-C file. Should I use the swift one?
I thought you were using Swift. If you're using Obj-C use the Objective C one. Enjoy!
I’m having some issues too with Xcode 12
I can successfully build the project on Xcode 11. However as soon as I open the Xcode12 and build the project I get the following error:
▸ Linking OneSignalNotificationServiceExtension
❌ clang: error: no such file or directory: '/Users/carloscuesta/project-folder/ios/build/project/Build/Products/Debug-iphonesimulator/libRCTOneSignal.a'
This doesn’t seems an error from OneSignal side. Looks like there’s something weird with cache or something like that, things I tried:
- Delete Xcode Derived Data -
rm -rf ~/Library/Developer/Xcode/DerivedData/ - Clear react-native, yarn cache and reinstall dependencies.
- Reset simulator data and contents
- Restarted the computer
I don't know what else I should try, I would say that everything is linked properly since the application is working good on Production and the build works with Xcode 11.
I have the library linked manually using the OneSignal guide, any idea on how to fix this ? 🙏🏼
Typically when I got this issue it was solved by cleaning the DerivedData but I can't get rid of the error 😞
I've discovered something weird,
If I try to build the application with Xcode 12, it always fails. However If I build the application first with Xcode 11 and then open up Xcode 12 and build the app it works 🤯
However as soon as I clean build and try to rebuild again with Xcode 12 it starts to fail with the same error again 😖
Same error here with with Xcode 12 and onesignal-react-native 3.9.1 :-( Projects were working before the update.
Same error. Onesignal SDK -> 2.15.2 react-native-onesignal -> 3.9.1 Worked well on xCode 11.
Howdy, That's strange @carloscuesta . Have you tried seeing a diff between the project on Xcode 11 vs 12? Perhaps 12 is changing some important build settings for some reason.
Got similar issue when I updated my Xcode from 11 to 12..
Hey @rgomezp
I can confirm that there's no changes from Xcode 11 to Xcode 12. The git status of the repo is unmodified.
However I can still reproduce the build failed. And whenever I build on Xcode 11 and Xcode 12 after works for the first time 😕
Howdy, I believe this is related to the ongoing Cocoapods issue which was previously reported here.
This might work add x86_64 to VALID_ARCH if need to run app on simulator, e.g., x86_64 arm64 arm64e
This stack overflow might contain the solution you need.
Hey! Thanks for your help @rgomezp
I will tell you the results of my experiments!
Add Excluded Architectures
I introduced arm64 as suggested on the StackOverflow post on the Project> Architectures > Excluded Architectures.
This didn't fix the problem. I've got the same error complaining about x86_64.
So I went ahead and added x86_64 to the Excluded Architectures.
After the following change, the following error seems to be fixed. However I've got another error regarding to the OneSignalNotificationServiceExtension.appex.
Embedded binary is not signed with the same certificate as the parent app. Verify the embedded binary target's code sign settings match the parent app's.
However I did not change anything related with CodeSign 🤔 – The Xcode11 build works fine

After cleaning the DerivedData build and restart the computer. I'm seeing another error: Link app (i386).
If I open the error, I see that a lot of files are not being found on the DerivedData folder. None of them related with OneSignal. However I don't know why this is failing if it works properly on Xcode 11. I'm so confused right now 😅
Use VALID_ARCHS
This hasn't worked for me either. I also read that this is deprecated on Xcode 12 and Excluded Architecturesshould be used instead.
I didn't had any User-Defined Setting for this. Since I'm not using CocoaPods and I've got the module linked manually.
I found and interesting link that talks about the "same certificate" error with Xcode after excluding arm64.
It says that the extensions should not exclude those architectures. Same error unfortunately :(
I'm out of ideas for today 😅
I can confirm that building and running the application on a real device does not throws any error without the "Excluded Architectures" modifications.
So it's something related 100% with the architecture of the simulator itself
Hola Carlos, Thank you for the detailed investigation. For visibility, I also found this stack overflow thread.
To summarize @carloscuesta issue,
- The
Embedded binary is not signed with the same certificate as the parent app...error is resolved by adding arm64 and x86_64 to the Excluded Architectures, per guidance to use this over VALID ARCHS. - The workaround posted in the Cocoapods repository didn't work for you because you have the library manually linked.
Carlos, at this point I am not sure what else can be done since this sounds like a non-OneSignal issue.
Can other folks please confirm that the Cocoapods workaround linked above works for them if they are using Cocoapods?
Hey @rgomezp
Thanks for all the help you provided.
Carlos, at this point I am not sure what else can be done since this sounds like a non-OneSignal issue.
I'm not 100% sure with this statement since If I unlink the whole OneSignal library and I remove the OneSignalNotificationServiceExtension the project builds on Xcode12. I don't know where the error is coming from that's for sure and maybe that's a specific case since the library is manually linked. And I don't have to touch anything related with architectures
But yeah, let's see if we can found another use cases 👍🏼
It seems Xcode 12 build for simulator with architecture - arm64, i386, x86_64.
So my workaround solution is
- Add arm64 in Excluded Architectures of Project Build setting
- Remove VALID ARCHS from RCTOneSignal subproject build setting. (VAILD ARCHS was moved to User-Defined of build setting in Xcode 12)
It works well in my project.
@stanleyctcl Your solution works! :tada:
I didn't saw the RCTOneSignal target inside of the RCTOneSignal library had the VALID_ARCHS defined as a User-Defined setting. This is something we should remove from the Library side! I'm going to make a PR to fix the issue!

That's why all my changes didn't work. Because the OneSignal library has this User-Setting defined.
Hey, thanks @stanleyctcl Your solution worked for me.
Previously, my build on release mode to iOS Simulator is failed. I got building for iOS Simulator, but linking in object file built for iOS, file onesignal error. But, I can build release mode on real device without any errors appeared. The solution above solved this issue.
Unfortunately, after I implemented your solution, I could not Archive my app. I got this error.
No architectures to compile for (ARCHS=arm64, VALID_ARCHS=arm64 arm64e armv7 armv7s, EXCLUDED_ARCHS=(
arm64
))
any clue?
@abdullahizzuddiin Make sure you only Excluded the architecture for iOS simulators


