Taracque / cordova-plugin-braintree

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

Expected "/* Begin ", "/* End ", "\"", or [A-Za-z0-9_.] but "/" found. #52

Open EfosaSO opened 6 years ago

EfosaSO commented 6 years ago

Each time I install the Ionic Braintree plugin and build for iOS, it throws this error right after the cordova build ios terminal prompt

Expected "/* Begin ", "/* End ", "\"", or [A-Za-z0-9_.] but "/" found I've tried removing the ios platform and then installing the plugin, then build for ios ionic cordova build ios. It breaks.

When I remove the platform and ionic cordova build ios it builds the ios platform but as soon as I run ionic cordova run ios it throws the same error.

This error is only thrown for the ios platform, Android builds perfectly.

My cordova version in package.json is "cordova": "^8.0.0" My braintree is "@ionic-native/braintree": "^4.5.0" My ios is "cordova-ios": "4.5.4"

Can't seem to find a solution 🤷🏾‍♂️ online for this and thought someone here could help

EfosaSO commented 6 years ago

Installing the dpa99c of the plugin seems to fix this

ionoc cordova plugin add https://github.com/dpa99c/cordova-plugin-braintree

niccolofanton commented 6 years ago

I think this is a simple syntax error. I hope it will be fixed soon :D

Lechevallier commented 5 years ago

I'm going mad with this.

Effectively, dpa99c plugin allows me to build successfully, but when I want to publish it to the AppStore, I get the following error:

Upload failed error: App Store Connect Operation Error ERROR ITMS-90087: "Unsupported Architectures. The executable for Sheltair.app/Frameworks/Braintree3DSecure.framework contains unsupported architectures '[x86_64, i386]'."

image

The only thing that the dpa99c plugin is doing is to avoid executing the script plugin if cordova version is up to 7. See here

So I supposed that this script avoid the previous errors that fail the upload.

I didn't go through the code of this script yet but there must be an error syntax that must be corrected. @Taracque could you provide some support please ?

Here is my config :

Ionic:

   ionic (Ionic CLI)  : 4.4.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.0.1

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.1.3, ios 4.5.5
   Cordova Plugins       : no whitelisted plugins (19 plugins total)

System:

   Android SDK Tools : 26.1.1 (/Users/miguel/Library/Android/sdk/)
   ios-deploy        : 1.9.4
   NodeJS            : v8.11.3 (/usr/local/Cellar/node@8/8.11.3_1/bin/node)
   npm               : 5.6.0
   OS                : macOS High Sierra
   Xcode             : Xcode 10.1 Build version 10B61

Thanks

Lechevallier commented 5 years ago

Well, I finally end up using dpa99c plugin that is basically preventing from excuting the plugin script if cordova version >= 7. See here

However, one part of this script is still required , and I'm performing it later in the XCode phase build. (here the full instructions)

ciccilleju commented 4 years ago

I'm going mad with this.

Effectively, dpa99c plugin allows me to build successfully, but when I want to publish it to the AppStore, I get the following error:

Upload failed error: App Store Connect Operation Error ERROR ITMS-90087: "Unsupported Architectures. The executable for Sheltair.app/Frameworks/Braintree3DSecure.framework contains unsupported architectures '[x86_64, i386]'."

image

The only thing that the dpa99c plugin is doing is to avoid executing the script plugin if cordova version is up to 7. See here

So I supposed that this script avoid the previous errors that fail the upload.

I didn't go through the code of this script yet but there must be an error syntax that must be corrected. @Taracque could you provide some support please ?

Here is my config :

Ionic:

   ionic (Ionic CLI)  : 4.4.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.0.1

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.1.3, ios 4.5.5
   Cordova Plugins       : no whitelisted plugins (19 plugins total)

System:

   Android SDK Tools : 26.1.1 (/Users/miguel/Library/Android/sdk/)
   ios-deploy        : 1.9.4
   NodeJS            : v8.11.3 (/usr/local/Cellar/node@8/8.11.3_1/bin/node)
   npm               : 5.6.0
   OS                : macOS High Sierra
   Xcode             : Xcode 10.1 Build version 10B61

Thanks

add this to build phases

Type a script or drag a script file from your workspace to insert its path.

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

This script loops through the frameworks embedded in the application and

removes unused architectures.

find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK do FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable) FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME" echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"

EXTRACTED_ARCHS=()

for ARCH in $ARCHS
do
    echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
    lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
    EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done

echo "Merging extracted architectures: ${ARCHS}"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
rm "${EXTRACTED_ARCHS[@]}"

echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"

done