CyberSource / cybersource-ios-sdk

The CyberSource InApp SDK enables developers to simply and securely incorporate mobile payments into their iOS applications.
Other
1 stars 1 forks source link

Bitcode fix #9

Closed drmontgomery closed 6 years ago

drmontgomery commented 6 years ago

Hi there!

I ran into an apparent bitcode problem when trying to include the cybersource-ios-sdk (version 1.0.1) via Cocoapods. When archiving the project which depends on the InAppSDK framework, I get the following error: ld: bitcode bundle could not be generated because '/Pods/cybersource-ios-sdk/Frameworks/InAppSDK.framework/InAppSDK' was built without full bitcode. All frameworks and dylibs for bitcode must be generated from Xcode Archive or Install build file '/Pods/cybersource-ios-sdk/Frameworks/InAppSDK.framework/InAppSDK' for architecture arm64

I can easily reproduce this problem by creating a default iOS app project in Xcode, including the cybersource-ios-sdk dependency via Cocoapods, and running the Archive action.

It looks like the InAppSDK framework is intended to be built by the UniversalInAppSDK target, which uses xcodebuild to run the clean and build actions for the InAppSDK target. After searching a bit, I learned that Xcode only embeds full bitcode when performing an Archive action; when running the build action, it embeds only bitcode markers for performance reasons. Commit 35bc435 uses BITCODE_GENERATION_MODE to force Xcode to embed full bitcode when running the build action.

I also noticed an error ("Unknown build action 'x86_64'") when the UniversalInAppSDK script builds the iphonesimulator version of the framework. The script tries to pass two architectures (i386 and x86_64) via the -arch flag, which only accepts one argument. Commit 44c0d79 uses a combination of VALID_ARCHS and ONLY_ACTIVE_ARCH=NO to select both i386 and x86_64 for the simulator build.

Based on the previous pull request, I also updated the version numbers and rebuilt the binaries.

Anyway, I figured I'd create a pull request for the changes in case anyone else has run into these issues. Please let me know if you have any questions or change requests.

Thanks for the very helpful library.

-David