Closed jbatra-umeey closed 3 years ago
As a workaround can we skip PayPalDataCollector from cocoa pods?
This depends on which payment methods you're using. If you're using PayPal, which is included by default with pod 'Braintree'
, then PayPalDataCollector
is required. You can take a look at all of the dependencies in Braintree.podspec
.
As mentioned in #651, we don't officially support React Native. However, if you have any suggestions or ideas about how to fix this issue, we're more than happy to review a PR.
@sestevens Thanks for the prompt revert. Any tips to debug it?
Few workarounds I tried :
https://stackoverflow.com/questions/30355133/swift-framework-umbrella-header-h-not-found
Manually added the header search path for the umbrella header
I suppose we should also have a look at Braintree.modulemap
module Braintree {
umbrella header "Braintree-umbrella.h"
export *
module * { export * }
}
I found a similar issue on CocoaPods, but it looks like the solution there was to use angle brackets < >
on the import instead of quotes, which we're already doing.
I also see a similar issue here, and the solution was to use @import
instead of #import
. That might be worth a try, as long as it doesn't break anything for integrations that aren't using React Native.
Ok, I managed to fix the umbrella header issue in BTPayPalDriver.m by replacing
#import <Braintree/Braintree-Swift.h>
with #import "Braintree-Swift.h"
I was getting the below issue on Xcode 12.4
:
Undefined symbols for architecture arm64:
"__swift_FORCE_LOAD_$_swiftWebKit", referenced from:
__swift_FORCE_LOAD_$_swiftWebKit_$_Braintree in libBraintree.a(PPDataCollector.o)
(maybe you meant: __swift_FORCE_LOAD_$_swiftWebKit_$_Braintree)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Fixed it by adding libSwiftWebKit.TBD
. Reference: https://developer.apple.com/forums/thread/655438
@sestevens should I raise a PR for the React-native sample?. Also, could you please review the fix for Braintree-Swift.h
and include it your release?
@jbatra-umeey Could you post a link to the React Native sample app you're using?
@sestevens I kept https://github.com/wgltony/react-native-braintree-dropin-ui as the base and customized based on my requirements. For now, maybe we could use this one for testing
Disclaimer: This project needs some migration-related changes. Might need to fix them but it should be good to start with.
Updated podspec : https://github.com/wgltony/react-native-braintree-dropin-ui/blob/master/ios/RNBraintreeDropIn.podspec
Pod::Spec.new do |s|
s.name = "RNBraintreeDropIn"
s.version = "1.0.0"
s.summary = "RNBraintreeDropIn"
s.description = <<-DESC
RNBraintreeDropIn
DESC
s.homepage = "https://github.com/bamlab/react-native-braintree-payments-drop-in"
s.license = "MIT"
# s.license = { :type => "MIT", :file => "../LICENSE" }
s.author = { "author" => "lagrange.louis@gmail.com" }
s.platform = :ios, "12.0"
s.source = { :git => "https://github.com/BradyShober/react-native-braintree-dropin-ui.git", :tag => "master" }
s.source_files = "*.{h,m}"
s.requires_arc = true
s.dependency 'React'
s.dependency 'Braintree'
s.dependency 'BraintreeDropIn'
s.dependency 'Braintree/DataCollector'
s.dependency 'Braintree/Apple-Pay'
s.dependency 'Braintree/Venmo'
end
Example App : Braintree.zip
@sestevens could you please share an update on the suggested changes?. Also, please let me know if you need any help in compiling the react native sample
Hi @jbatra-umeey, we haven't had a chance to reproduce this yet, but we're planning to take a look at the sample app you linked to. I want to be careful about using #import "Braintree-Swift.h"
because we've had issues with "
-style imports before. But we'll try it out when we get a chance!
We don't have an exact timeline for when we'll have a chance to tackle this, but I'll keep you posted on any progress.
@sestevens is there any sample to compile the code using source files?
@jbatra-umeey Here's a demo app that's included in this repo. Also, we tried changing the import to #import "Braintree-Swift.h"
, but it's causing pod lib lint
to fail with an error about not being able to find that file. We'll keep investigating and let you know if we come up with a solution.
@sestevens would you recommend building the pod from the local file path of SPM? Or any tips on importing headers from SPM in the cocoa pods project?
For example, in my case, the dependency of my development pod is on :
s.dependency 'BraintreeDropIn'
s.dependency 'Braintree/DataCollector'
s.dependency 'Braintree/Apple-Pay'
s.dependency 'Braintree/Venmo'
FYI, As of now, I am using the source files to generate the pods
My profile:
pod 'Braintree', :path => '/Users/xxx/sources/braintree_ios-master'
👋 Hello @jbatra-umeey - I am able to get #import "Braintree-Swift.h"
working for a React-Native app. After that, I am also able to replicate the swiftWebKit
type issues you were seeing.
Question - is the native iOS portion of your React-Native app written in pure Objective-C?
If so, I was able to resolve the swiftWebKit
type issue by adding an empty Swift file into my application, and letting XCode properly generate and link a bridging header. (SO post for reference). This removed the need to manually include libSwiftWebKit
& other similar frameworks.
Please let me know if that gets things working for you. You can test using our branch react-native
(link).
@scannillo thanks for the quick update. I will try it out react-native
branch on my end and share the update
Yes, the code is written in Objective-C
I believe the changes you pointed out w.r.t swiftWebKit
should work as per SO post
👋 Hello. We have released a fix for this in Braintree iOS v5.3.2.
Integration Details
Describe the bug
When updating to 5.3.0 we get an error during the compilation of the header file 'Braintree/Braintree-Swift.h' . The current version we are using is 4.37.1 In continuation to issue https://github.com/braintree/braintree_ios/issues/651
Podfile :
To Reproduce There are no explicit steps to reproduce, other than try to update the version
Expected behavior Success build with the latest version
Screenshots
In the project directory, I can see this file present. Any changes needed in the main project's build settings?
As a workaround can we skip
PayPalDataCollector
from cocoa pods?