Taracque / cordova-plugin-braintree

:credit_card: A Cordova plugin for the Braintree mobile payment processing SDK.
MIT License
27 stars 42 forks source link

Fix iOS error with hook script on cordova@7 #44

Open dpa99c opened 7 years ago

dpa99c commented 7 years ago

This fixes a build issue on iOS when using cordova@7 caused by the add_embedded_ios_frameworks.js hook script which adds the frameworks to the Xcode project.

The error occurs because cordova@7 itself now adds the embed configuration to the Xcode project, so running the hook script causes an error.

Subsequently, Xcode will not open the project: Project /projects/@scratch/cordova-plugin-braintree-test/platforms/ios/Braintree Test.xcodeproj cannot be opened because the project file cannot be parsed.

I've added a line to the hook script to abort if the Cordova CLI version is >= 7.

This is a similar issue to this one encountered with the Tealium plugin, and is possibly the cause of #34.

See below the console output using your current version of the plugin (which results in the error) vs the console output using my modified version:

console output for taracque/cordova-plugin-braintree ``` $ cordova -v 7.1.0 $ cordova plugin add https://github.com/taracque/cordova-plugin-braintree.git Adding cordova-plugin-braintree to package.json Saved plugin info for "cordova-plugin-braintree" to config.xml $ cordova platform add ios Using cordova-fetch for cordova-ios@^4.5.2 Adding ios project... Creating Cordova project for the iOS platform: Path: platforms/ios Package: io.cordova.braintree.test Name: Braintree Test iOS project created with cordova-ios@4.5.2 Installing "cordova-plugin-braintree" for ios Embedded Frameworks in cordova-plugin-braintree Added Arch stripping run script build phase Installing "cordova-plugin-whitelist" for ios --save flag or autosave detected Saving ios@~4.5.2 into config.xml file ... Embedded Frameworks in cordova-plugin-braintree Added Arch stripping run script build phase $ cordova prepare ios Error: Expected "/* Begin ", "/* End ", "\"", or [A-Za-z0-9_.] but "/" found. $ ```
console output for dpa99c/cordova-plugin-braintree ``` $ cordova -v 7.1.0 $ cordova plugin add https://github.com/dpa99c/cordova-plugin-braintree.git Adding cordova-plugin-braintree to package.json Saved plugin info for "cordova-plugin-braintree" to config.xml $ cordova platform add ios Using cordova-fetch for cordova-ios@^4.5.2 Adding ios project... Creating Cordova project for the iOS platform: Path: platforms/ios Package: io.cordova.braintree.test Name: Braintree Test iOS project created with cordova-ios@4.5.2 Installing "cordova-plugin-braintree" for ios Installing "cordova-plugin-whitelist" for ios --save flag or autosave detected Saving ios@~4.5.2 into config.xml file ... $ cordova prepare ios $ ```
davefv commented 6 years ago

@Taracque It is planned to merge this PR soon? Thanks!

aelx311 commented 4 years ago

I tried this locally, it does fix the error in .xcodeproj file. However, when I try to upload my app to AppStoreConnect, it failed due to "Unsupported Architectures" error.

image