Appboy / appboy-ios-sdk

Public repo for the Braze iOS SDK
https://www.braze.com
Other
165 stars 142 forks source link

SPM script not found while archiving iOS app from command line #287

Closed chrismanderson closed 3 years ago

chrismanderson commented 3 years ago

Report

Describe your environment.

Info Value
Platform Name ios
Platform Version 12.3
SDK Version 4.0.0
Integration Method spm
Xcode Version Xcode 14.3
Repro rate 100%

What did you do?

We recently update our app to use 4.0.0 of the Braze SDK using SPM. We had been using version 3.30.0 of the SDK, also with SPM. I updated the build post-action to

bash "$BUILT_PRODUCTS_DIR/Appboy_iOS_SDK_AppboyKit.bundle/Appboy.bundle/appboy-spm-cleanup.sh"

What did you expect to happen?

The build to build via the command line with no warnings or errors.

What happened instead?

When I build on the command line (using fastlane), I get the error message

bash: /Users/username/Library/Developer/Xcode/DerivedData/AppName-rxxzeaxkeceisgpqbvrnkkdtjsk/Build/Products/Debug-iphoneos/Appboy_iOS_SDK_AppboyKit.bundle/Appboy.bundle/appboy-spm-cleanup.sh: No such file or directory

If I try to navigate to that directory, there's nothing there. All I see is a Intermediates.noindex folder inside of ~/Library/Developer/Xcode/DerivedData/AppName-dfdfsfdsfdsf/Build/ but no other folders.

It seems like the build works successfully (though I currently can't upload to TestFlight due to https://github.com/Appboy/appboy-ios-sdk/issues/285. I'm unsure if this script file failing is expected behavior with an archive, and if so, if it can be removed. Or, if there is some issue caused by this.

chshapiro commented 3 years ago

Hey @chrismanderson,

Are you able to archive successfully through Xcode?

hyazel commented 3 years ago

Same issue here !

chrismanderson commented 3 years ago

Hey @chrismanderson,

Are you able to archive successfully through Xcode?

I can archive both with Xcode and Fastlane. In Xcode, it's unclear to me if the Braze script is firing or not, as I don't see it in the Xcode build logs. Tried adding an echo debug line, but nothing appeared - though I'm not certain where those scheme actions appear in logs regardless.

When I archive with fastlane, the build still archives successfully btw even with the error around the script.

lowip commented 3 years ago

Hey @chrismanderson,

Could you verify that your app is selected for the line Provide build settings from ... in your scheme's post-actions:

Screen Shot 2021-03-19 at 2 32 30 PM

The standard output from that script is only visible when building via xcodebuild in the terminal. I think adding the --verbose flag to your fastlane call might show those extra logs when archiving.

In order to debug, could you add those few lines before the call to our script:

echo "==========================="
echo "BUILT_PRODUCTS_DIR:" "$BUILT_PRODUCTS_DIR"
ls -al "$BUILT_PRODUCTS_DIR"

This will print the path and content of the BUILT_PRODUCTS_DIR environment variable set by Xcode.

Failure to run appboy-spm-cleanup.sh might prevent you from successfully uploading the archive to Testflight or the App Store. Xcode mistakenly copies static libraries / frameworks to your app archive when integrating via SPM. Our cleanup script remove those extra copies from your archive in order to pass the App Store validation.

We are monitoring new versions of Xcode to hopefully remove the need for that cleanup script in the future.

chrismanderson commented 3 years ago

Thank you @lowip I will give those suggestions a try. To confirm, if the script fails, but the app still uploads to Testflight/App Store - there's no risk or danger from that, correct? The script is intended to address issues with the archive, but if the archive still somehow passes validation, then the script (or the lack thereof) has no effect?

hyazel commented 3 years ago

@lowip I updated Provide build settings from and it worked, thanks !

hokstuff commented 3 years ago

Hi @chrismanderson,

Are you still experiencing this issue? To answer your previous question, yes this script was intended to clean up the archiving issues that would block people from submitting to App Store Connect. If you are able to submit successfully even without the script, then it may be possible that it is not necessary in your current case (possibly due to an Xcode update, details around your specific setup, etc). Let us know if you run into any more issues!

hokstuff commented 3 years ago

Closing out this issue due to inactivity, and since the instructions above appears to have helped. Feel free to comment if this is still a concern.

suhabaobaid commented 1 year ago

I am currently experiencing the same issue on Xcode 14.3.1. My app is selected for the line Provide build settings from ... in the scheme's post-actions.

Is it possible the script is not needed for this xcode version? Otherwise what might be the fix for it?