New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OneSignal OneSignalNotificationExtension build fail on Xcode 12 related to cocoapods / architecture / simulator issues #1036
Comments
Howdy, 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:
This doesn’t seems an error from OneSignal side. Looks like there’s something weird with cache or something like that,
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 |
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 :-( |
Same error. |
Howdy, |
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 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, This might work add 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 ArchitecturesI introduced This didn't fix the problem. I've got the same error complaining about So I went ahead and added After the following change, the following error seems to be fixed. However I've got another error regarding to the
However I did not change anything related with CodeSign 🤔 – The Xcode11 build works fine After cleaning the If I open the error, I see that a lot of files are not being found on the Use
|
I found and interesting link that talks about the "same certificate" error with Xcode after excluding It says that the extensions should not exclude those architectures. Same error unfortunately :( I'm out of ideas for today 😅 |
Hola Carlos, To summarize @carloscuesta issue,
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.
I'm not 100% sure with this statement since If I unlink the whole OneSignal library and I remove the 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
It works well in my project. |
@stanleyctcl Your solution works! 🎉 I didn't saw the That's why all my changes didn't work. Because the OneSignal library has this User-Setting defined. |
Hey, thanks @stanleyctcl Previously, my build on release mode to iOS Simulator is failed. I got Unfortunately, after I implemented your solution, I could not Archive my app. I got this error.
any clue? |
@abdullahizzuddiin Make sure you only Excluded the architecture for iOS simulators |
Ah, my bad. I forgot the little detail. Thanks @carloscuesta for pointing me. It turned out that I only need set = = = I can deploy an app to Appstore without any problem on previous version of Xcode. Previously, I used 11.7. Now, I used 12.0 and I instantly got this error without any changes on my repo.
Any clue? or should I create separated issue? p.s: |
i am using react-native-onesignal 3.9.1 on react native 0.60.0 version...I am able to resolve this issue by including x86_64 inside User-Defined settings (VALID_ARCHS) |
Howdy y'all, @abdullahizzuddiin For visibility, I will post one of the responses to the Apple Dev Forum thread: PROBLEM: Xcode Help Online Manual Accounts preferences To open Accounts preferences, choose Xcode > Preferences and click Accounts. PROBLEM SOLVED: |
Hey @rgomezp This issue was a mix of different problems. The one you're pointing has nothing to do with the Simulator issue itself, that is something that has to do with I don't know if we should close this issue completely until the simulator one is solved. |
Hi @rgomezp I've followed the suggestion from Apple Dev Forum that you excerpted above. But, it didn't solved my problem. Temporarily, I downgraded Xcode version to 11.7 and I able to build, run, and archived successfully. But, I still can do those act in Xcode 12.0 |
I will leave this open to be closed automatically by #1053 |
This works for me. Remember to delete it. Not just make it blank "" as it would not work edit: I tried stanleyctcl solution which works in simulator for debug and release build. But when build for Generic device/Archive I faced the same problem as abdullahizzuddiin
The solution that worked for me is
This should make Archive work but simulator release fail. To fix that. you need to go All project target's and pod's target -> Build Settings -> Architecture -> Build Active Architecture Only -> Set 'Yes' for release mode Explanation and Steps on: https://stackoverflow.com/a/64139830/9232424. |
Same issue happened with me in xcode 12, Did you solve the issue? @abdullahizzuddiin or u just downgrade the xcode to 11.7 thank you |
To run in the simulator, I have to add "arm64" in "Excluded architectures". I hope this helps. |
Same issue here, it came back. |
Same |
1 similar comment
Same |
@rgomezp I'm seeing this issue after updating to "react-native-onesignal": "^4.3.0" and pod 'OneSignal', '>= 3.0', '< 4.0'. Archiving the build fails with:
EDIT |
Where do I find this settings in xcode? |
Description:
Just updated from Xcode 10 to Xcode 12, before on v10 this project built and run successful.
OneSignalNotificationExtension target build fail:
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:
The text was updated successfully, but these errors were encountered: