paypal / paypal-here-sdk-ios-distribution

Add credit card (tap, insert, swipe & key-in) capabilities to your iOS app
Other
81 stars 91 forks source link

Cordova / phonegap support #320

Open steffanhalv opened 4 years ago

steffanhalv commented 4 years ago

Will you add cordova / phonegap support for this please? We tried to fork a project from npm and edit it with the latest version of the library, but when we run the xcode project we get an error:

"Include of non-modular header inside framework module 'PayPalRetailSDK':

Skjermbilde 2019-11-30 kl  18 26 22

And if we fix this by copying those two files into the framework the app runs successfully but crashes with the following error:

dyld`__abort_with_payload:
    0x10ab4c3a4 <+0>:  movl   $0x2000209, %eax          ; imm = 0x2000209 
    0x10ab4c3a9 <+5>:  movq   %rcx, %r10
    0x10ab4c3ac <+8>:  syscall 
->  0x10ab4c3ae <+10>: jae    0x10ab4c3b8               ; <+20>
    0x10ab4c3b0 <+12>: movq   %rax, %rdi
    0x10ab4c3b3 <+15>: jmp    0x10ab4b9bd               ; cerror_nocancel
    0x10ab4c3b8 <+20>: retq   
    0x10ab4c3b9 <+21>: nop    
    0x10ab4c3ba <+22>: nop    
    0x10ab4c3bb <+23>: nop

dyld: Library not loaded: @rpath/AFNetworking.framework/AFNetworking
  Referenced from: /Users/.../Library/Developer/CoreSimulator/Devices/B8D74585-5D67-4EC4-965E-5A5A4D2D2139/data/Containers/Bundle/Application/3F789E15-BE67-4AB1-A7FB-7E93F571B747/StorePilot.app/Frameworks/PayPalRetailSDK.framework/PayPalRetailSDK
  Reason: image not found

Here is a link to our repo: https://github.com/StorePilot/corodova-plugin-paypal-here

Edit: The latest error we got looks related to this: https://github.com/paypal/paypal-here-sdk-ios-distribution/issues/255

ppmtscory commented 4 years ago

Unfortunately we don't offer official support for Cordova/Phonegap at this time but will take this feedback into consideration as we look into alternative development options in the future.

DowsingUK commented 4 years ago

Is there anyway to workaround this error I think there's so many people using Cordova/Phonegap and your Here service is getting popular so you should rush on this before the hype goes some where else

asa47 commented 4 years ago

Hello @steffanhalv, you can add the PayPalHereSDKv2 to a cordova project with the cordova-plugin-cocoapod-support.

Just modify you config.xml to something like the following:

    <platform name="ios">
        <dependency id="cordova-plugin-cocoapod-support"/>
        <pods-config use-frameworks="true"></pods-config>
        <pod name="PayPalHereSDKv2/Release" />

        <!-- Add the rest of the scripts afterwards (i.e. config-file, source-file etc...) -->
    </platform>

After installing the plugin, just run the command cordova prepare ios, it will automatically install the pod PayPalHereSDKv2 in your project.

DowsingUK commented 4 years ago

asa47 we tried your solutions but we've got the same result 'PPRetailInstrumentInterface/PPRetailInstrumentInterface.h' file not found is there any specific version working with this method? we tried last 20 with no luck, is it working for you?

asa47 commented 4 years ago

@DowsingUK Yes it working for us. Just to confirm, after installing the pod, are you opening the xcworkspace or the xcodeproj? You should be using the xcworkspace.

steffanhalv commented 4 years ago

@asa47 Does it also work for Android? I haven't got time to test your ios solution just yet, but it would be awesome if it works.

DowsingUK commented 4 years ago

@asa47 sure we're using xcworkspace and we've try with different versions of MacOSX, Cordova/Phonegap, XCodes and nothing works always getting 'PPRetailInstrumentInterface/PPRetailInstrumentInterface.h' file not found

@steffanhalv Android has been working good so far for us

asa47 commented 4 years ago

@DowsingUK @steffanhalv I have forked your plugin, please see my changes. corodova-plugin-paypal-here

  1. Install the plugin with cordova plugin add https://github.com/asa47/corodova-plugin-paypal-here.git
  2. Run cordova prepare ios
  3. Open the xcworkspace in XCode, and build the project. It should work, I have tested it on an empty project.
  4. You will have to re-write the ios src code in Objective C or you can just use a Bridging-Header and use the previous implementation.

If you are still having issues there might be something wrong with your XCode project.

@steffanhalv I havent used the android SDK, but it should be straightforward, just update your gradle with the new dependency and build the project in Android studio.

steffanhalv commented 4 years ago
  1. You will have to re-write the ios src code in Objective C or you can just use a Bridging-Header and use the previous implementation.

@asa47 That is actually a big part of the problem. AFNetworking is not working which should be used there. See my error log in the first post 😅.

And honestly I am also not so good at writing Objective C code...

Otherwise, thank you very much ;)

DowsingUK commented 4 years ago

add this line in config.xml and try running a clean ios platform install <preference name="deployment-target" value="8.1" />