Appboy / appboy-ios-sdk

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

SPM Support - Assertion failed: Expected 2 archs in otool output for libAppboyKitLibrary.a (armv7) #260

Closed juliensechaud closed 3 years ago

juliensechaud commented 3 years ago

Report

Describe your environment.

Info Value
Platform Name ios
Platform Version > 10.3
SDK Version e.g. 3.29.0
Integration Method SPM
Xcode Version Xcode 12.4
Repro rate all the time (100%)

What did you do?

Integrate Braze through SPM following https://www.braze.com/docs/developer_guide/platform_integration_guides/ios/initial_sdk_setup/swift_package_manager/#step-2-configuring-your-project Only AppboyUI. Removing lib at post-Build rm -rf "${TARGET_BUILD_DIR}/${PRODUCT_NAME}.app/Frameworks/libAppboyKitLibrary.a" rm -rf "${TARGET_BUILD_DIR}/${PRODUCT_NAME}.app/Plugins/libAppboyKitLibrary.a"

Why do we need to do that ?

What did you expect to happen?

Export IPA properly

What happened instead?

Archiving is OK but when exporting (AppStore or Development) when xcodebuid scans the IPA it fails with following error : Assertion failed: Expected 2 archs in otool output: Archive : /var/folders/dw/XXX/T/IDEDistributionOptionThinning.~~~YYYY/Payload/MY_APP.app/Frameworks/libAppboyKitLibrary.a (architecture armv7) /var/folders/dw/XXX/T/IDEDistributionOptionThinning.~~~YYYY/Payload/MY_APP.app/Frameworks/libAppboyKitLibrary.a(ABKInAppMessageHTMLBase.o) (architecture armv7): Mach header

Steps to reproduce

Just add only AppboyUI through SPM, Archive for Any iOS Device (armv7, arm64) and Export

juliensechaud commented 3 years ago

Ok found it I was not removing lib at post-BUILD at proper path

Indeed my Appboy framework is wrapped into a dynamic framework in order to use it in multiple target and I had to remove it like that rm -rf "${TARGET_BUILD_DIR}/${PRODUCT_NAME}.app/Frameworks/MY_WRAPPER+FRAMEWORK.framework/Frameworks/libAppboyKitLibrary.a"

Could you give us an alternative to this strange post build stripping ?

Thanks

lowip commented 3 years ago

@juliensechaud I'm glad you were able to find a workaround.

Could you give us an alternative to this strange post build stripping ?

Unfortunately this post-build strip step is currently necessary due to a bug in the current version of the Xcode / SPM integration. Xcode embeds binary frameworks/libraries without regard if those are dynamically linked or not. Our SDK is distributed as a static library and Xcode (wrongly) embeds it in the final archive when releasing.

We're monitoring any new version of Xcode so that we can hopefully remove this requirement in the future.