OneSignal / OneSignal-XCFramework

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native iOS app with OneSignal. https://onesignal.com. This Repository hosts OneSignal's XCFramework to be used with Swift Package Manager
Other
26 stars 4 forks source link

Unable to upload to App Store Connect #10

Open loganblevins opened 3 years ago

loganblevins commented 3 years ago

Error with Xcode Version 12.4 (12D4e):

The bundle Payload/Covenant Eyes.app/PlugIns/OneSignal.framework is not contained in a correctly named directory. It should be under "Frameworks".".

Issue is resolved by hand, deleting framework from PlugIns.

https://forums.swift.org/t/swift-package-binary-framework-issue/41922

However, OneSignal is the only troublesome SPM package I've encountered - and we use multiple SPM packages.

Is there anything OneSignal can do to resolve this?

loganblevins commented 3 years ago

We have had to revert back to the standard framework package to avoid this bug.

This XCFramework is quite literally unusable as-is. Our automated builders are failing to upload to App Store Connect and we cannot rely on developers deleting a duplicate framework within an archive to make the upload succeed.

blorsch commented 3 years ago

We are also experiencing this issue. After adding via SPM OneSignal works perfectly and can be archived, but when we go to upload to App Store Connect we receive a whole slew of errors:

Screen Shot 2021-03-21 at 10 58 12 PM Screen Shot 2021-03-21 at 11 04 26 PM

If I inspect the .app file, it looks like OneSignal.framework and the notification app extension are being placed within the "PlugIns" folder, erroneously according to Xcode. We have other SPM packages and we’ve been able to successfully upload builds for months with them. We are planning to use OneSignal in production, but we can’t until we can upload builds.

Any help would be much appreciated. This is with OneSignal-XCFramework v3.3.0 and Xcode 12.4.

josala commented 3 years ago

I had the same issue and I had to remove the OneSignal Swift package and install it via pod. Make sure to specify the latest version (currently pod 'OneSignal', '3.4.0') because otherwise installs 2.x and has some incompatibilities with the current SDK setup guide.

zoejessica commented 3 years ago

We are running into exactly the same issue - we were able to resolve (on CI too) by adding a final build phase script that removes the OneSignal framework from the Plugins folder, as per this technique by Kevin Bui. $(BUILT_PRODUCTS_DIR)/$(PLUGINS_FOLDER_PATH)/OneSignal.framework needs to be added as an Input File for the script.

Update: turned out to not be reliable - also reverting back to OneSignal-iOS-SDK for now.

salami commented 3 years ago

Same problem here. Using OneSignal-XCFramework SPM on an M1 Apple Silicon Mac. Xcode 12.5

I just switched over to OneSignal-iOS-SDK for now, still using SPM. Please address this, thank you.

acoomans commented 3 years ago

+1 same issue here. Would like to see this solved.

emawby commented 3 years ago

Thank you for reporting I am looking into this. It seems like other Binary Swift Packages are having similar issues . I was hopeful that Xcode 12.5 would solve the issue, but it seems it hasn't.

To be clear are folks having issues archiving their apps or is there only an issue occurring once the archive has been uploaded to App Store connect? In my testing I am able to successfully archive, but if I have an app extension or app clip that also uses the OneSignal library from the XCFramework Swift Package then validation fails when uploading to app store connect.

salami commented 3 years ago

The archive is successful. The error occurs at the end of the upload process and it does not get sent to App Store Connect.

emawby commented 3 years ago

I am able to reproduce this. I get the same errors as when I include the XCFramework directly and embed it both the App and Extension targets. I am not sure why SwiftPM is trying to embed the framework when it doesn't need to. I will look into ways to modify the Package itself to make it not do that, but otherwise we will need a build script or manual deletion of the framework from the plugin to resolve the issue until Apple addresses it. I apologize for the inconvenience.

The manual workaround that works for me is to modify the archive before validating/distributing it.

  1. Right click the Archive
  2. Show in finder
  3. Right click > Show package contents of the .xcarchive
  4. Products > Applications > xx.app > Right click Show package contents
  5. Plugins > OneSignalNotificationServiceExtension.appex > Right click Show package contents
  6. Delete the Frameworks folder.

If you have an app clip or other app extensions that depend on the XCFramework you will need to delete the Frameworks folder from them as well.

imrealashu commented 3 years ago

@emawby I've been facing the same issue and ended up here and did the steps you've mentioned. It solved two of the errors, thanks for that but, this still has 2 issues. Could you help me point out what are those? I'm using React Native (>0.60) with OneSignal. Screenshot 2021-06-13 at 03 35 21

Thanks in advance!

emawby commented 3 years ago

@imrealashu What version of React-Native-OneSignal are you using?

emawby commented 3 years ago

Updating with another workaround. Instead of directly including the OneSignal library in the NotificationServiceExtension target you can update the NSE's Runpath search paths build setting to include the path @executable_path/../../Frameworks. This will make it so that the NSE will look for Frameworks in the main app targets Frameworks directory. image

neha275 commented 2 years ago

+1 facing same issue can anybody resolved this?

Semty commented 2 years ago

@neha275 confirmed, it's still here @emawby when will this issue be fixed? Your second 'workaround' just doesn't work, the first one works, but it feels just wrong

ispiropoulos commented 2 years ago

@Semty the second "work around" was actually set by default on a project I am working. I was facing a different problem but triggered by the same root cause (Xcode was crashing at archive export), and it seems like adding the framework into the notification extension target is redundant, at least with Xcode 13.1 as it automatically configures Runpath Search Paths like @emawby described above.

cdf1982 commented 2 years ago

@emawby's workaround 1 is still useful: with Xcode 13.1 and OneSignalXCFramework 3.9.1 I could archive successfully, but as soon as I started the signing process in an Ad Hoc distribution, Xcode would actually crash!

Removing the folder as recommended fixed the crash and therefore the issue.

Hopefully, an actual solution that not requires spelunking in the package will be available with a future release.

paskcountry commented 2 years ago

Still same issue, I solved the problem with the workaround 1. Thanks @emawby ! .But not sure if it would not affect the behaviour of OneSignal Notifications. I am not able to deliver the notifications to all users (who has accept the push notifications of course). I am using SPM.

emawby commented 2 years ago

@paskcountry Hello I am sorry to hear about the issue with notification delivery. This issue should not be affecting that so if you are still having issues feel free to open a new issue on the iOS SDK repo.

paskcountry commented 2 years ago

Thanks for your reply emawby! I have integrated OneSignal in another app. And It's working fine. There's one step to integrate it that I have avoid this time. In the documentation page, to integrate it via Swift Package Manager (I love SPM) . STEP 6 : 6. Select the OneSignalNotificationServiceExtension (follow the setup guide if you have not created one yet) and under "Frameworks and Libraries" click the + button. I have not do it this time.

So no need to after archiving it, doing these steps, you told before:

Right click the Archive Show in finder Right click > Show package contents of the .xcarchive Products > Applications > xx.app > Right click Show package contents Plugins > OneSignalNotificationServiceExtension.appex > Right click Show package contents Delete the Frameworks folder.

The upload to the app store was successful and Notifications working really WELL.

emawby commented 2 years ago

Great that is good to know I will remove that line from the documentation

LukaszDziwosz commented 2 years ago

How to attach keys with SMP?

raphaeldcout commented 2 years ago

Hello, i'm experiencing this problem. Any permanent solution?

jarrodparkes commented 2 years ago

I'm still experiencing the same problem (CFBundleCollision) when trying to build with Bitrise CI/CD's most recent, stable stack — Xcode 13.2.x on macOS 11.6 (Big Sur).

mortenholmgaard commented 2 years ago

@emawby Please look into this issue! We have all kinds of problems with this with every release we are trying to make!!

mortenholmgaard commented 2 years ago

I didn't get this problem the first time I tried in xCode 13.3 - any one else that can verify if this is solved in that version?

paolosanchi commented 2 years ago

I solved by installing the framework with the CocoaPod (Option 3) instead of using the Swift Package Manager (Option 1). https://documentation.onesignal.com/docs/ios-sdk-setup#step-3-import-the-onesignal-sdk-into-your-xcode-project

marister commented 2 years ago

We solved it in our React Native project by telling the library not to embed Swift libraries. Hope it helps someone. (We use cocopods)

image

AlexHartford commented 2 years ago

This is still an issue regardless of how the extension or app is configured.

Using https://github.com/OneSignal/OneSignal-iOS-SDK instead works (Make sure to use at least this version and follow the instructions!) - but this issue needs to be addressed as the documentation for SPM is recommending this version of OneSignal.

It appears that the build I linked was actually created to solve this issue, but for some reason, there is no reference to it in this repository or the documentation.

Edit: I spoke too soon. It's not fixed. Had to use Carthage to install.

UraFIZ commented 1 year ago

What do you mean by saying 'otherwise installs 2.x '?

phanbaohuy96 commented 11 months ago

We solved it in our React Native project by telling the library not to embed Swift libraries. Hope it helps someone. (We use cocopods)

image

This saves my day! Tks you.

Senninseyi commented 2 weeks ago
Screenshot 2024-07-11 at 09 06 45

This is the issue i face when i try to push to appstore

when i remove the OneSignalNotificationServiceExtension.appex i get to publish successfully and i have my provisioning provider working fine