dmitry-blackwave / adyen-react-native

Adyen SDK for React Native
MIT License
15 stars 20 forks source link

XCode 10 ios 12 Could not find module Adyen for arm64 architecture #6

Open mkharibalaji opened 5 years ago

mkharibalaji commented 5 years ago

Hi @dmitry-blackwave ,

image

I was getting the above error when i did your installation steps and these were my Adyen Pods that got installed, Installing Adyen 2.8.1 Installing Adyen3DS2 (0.9.6) Installing AdyenInternal 2.8.1 Using AdyenReactNative (1.2.0)

My Pod File, ` platform :ios, '11.0' use_frameworks! target 'fermynt' do pod 'AdyenReactNative', :path => '../node_modules/adyen-react-native' end

post_install do |installer| installer.pods_project.targets.each do |target| if target.name == 'Adyen' target.build_configurations.each do |config| config.build_settings['SWIFT_VERSION'] = '4.2' end end end end ` But it didn't workout,so I did the manual linking as below and that too didn't work,

image

image

Could not find module Adyen for arm64 architecture

Compile Time Error.

GituBojan commented 5 years ago

same here.

mkharibalaji commented 5 years ago

After surfing through the internet,I raised a issue with adyen ios sdk as below,

https://github.com/Adyen/adyen-ios/issues/72

mkharibalaji commented 5 years ago

Hi @dmitry-blackwave , Adyen has released a new version today 2.8.3 which solves the above problem but ends up with another,

image

Then i added the implementation for PaymentControllerDelegate in AdyenReactNative.swift which was missing as per the new migration given below

https://github.com/Adyen/adyen-ios/blob/master/MIGRATION.md

func provideAdditionalDetails(_ additionalDetails: AdditionalPaymentDetails, for paymentMethod: PaymentMethod, detailsHandler: @escaping Completion<[PaymentDetail]>){ }

Then i removed the following lines from the Podfile post_install do |installer| installer.pods_project.targets.each do |target| if target.name == 'Adyen' target.build_configurations.each do |config| config.build_settings['SWIFT_VERSION'] = '5.0.1' end end end end

and then ran 'pod update' which ended with these libraries version,

Installing Adyen 2.8.3 (was 2.8.1) Installing Adyen3DS2 2.1.0-rc.1 (was 0.9.6) Installing AdyenInternal 2.8.3 (was 2.8.1) Using AdyenReactNative (1.2.0)

Then moved the ios Version for AdyenReactNativeProject to 11.3 to avoid armv7 missing architecture.

After this i replaced the Adyen framework in your nodemodules ios folder with the newly swift 5 compiled version ,linked the project manually and was able to proceed but while building at the final stage I am getting these errors,

` Showing Recent Messages :-1: Could not find auto-linked library 'swiftCoreGraphics'

:-1: Could not find auto-linked library 'swiftFoundation'

:-1: Could not find auto-linked library 'swiftMetal'

:-1: Could not find auto-linked library 'swiftDarwin'

:-1: Could not find auto-linked library 'swiftUIKit'

:-1: Could not find auto-linked library 'swiftCoreFoundation'

:-1: Could not find auto-linked library 'swiftObjectiveC'

:-1: Could not find auto-linked library 'swiftDispatch'

:-1: Could not find auto-linked library 'swiftCoreImage'

:-1: Could not find auto-linked library 'swiftQuartzCore'

:-1: Could not find auto-linked library 'swiftCore'

:-1: Could not find auto-linked library 'swiftSwiftOnoneSupport'

:-1: Undefined symbol: Foundation.URL._bridgeToObjectiveC() -> __C.NSURL

:-1: Undefined symbol: type metadata accessor for Foundation.URL

:-1: Undefined symbol: value witness table for Builtin.UnknownObject

:-1: Undefined symbol: (extension in Foundation):Swift.Dictionary._bridgeToObjectiveC() -> __C.NSDictionary

:-1: Undefined symbol: Swift.Dictionary.init(dictionaryLiteral: (A, B)...) -> [A : B]

:-1: Undefined symbol: (extension in Foundation):Swift.String._bridgeToObjectiveC() -> __C.NSString

:-1: Undefined symbol: static (extension in Foundation):Swift.String._unconditionallyBridgeFromObjectiveC(__C.NSString?) -> Swift.String

:-1: Undefined symbol: Swift.String.init(_builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String

:-1: Undefined symbol: type metadata for Swift.String

:-1: Undefined symbol: protocol witness table for Swift.String : Swift.Hashable in Swift

:-1: Undefined symbol: protocol witness table for Swift.String : Swift.Equatable in Swift

:-1: Undefined symbol: (extension in Foundation):Swift.Array._bridgeToObjectiveC() -> __C.NSArray

:-1: Undefined symbol: generic specialization of Swift.Array.init(arrayLiteral: A...) -> [A]

:-1: Undefined symbol: type metadata accessor for Swift.Array

:-1: Undefined symbol: type metadata for Swift.Bool

:-1: Undefined symbol: type metadata for Swift.Int

:-1: Undefined symbol: Swift.fatalErrorMessage(: Swift.StaticString, _: Swift.StaticString, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never

:-1: Undefined symbol: Swift._allocateUninitializedArray(Builtin.Word) -> ([A], Builtin.RawPointer)

:-1: Undefined symbol: generic specialization of Swift._allocateUninitializedArray(Builtin.Word) -> ([A], Builtin.RawPointer)

:-1: Undefined symbol: Swift.== infix<A where A: Swift.RawRepresentable, A.RawValue: Swift.Equatable>(A, A) -> Swift.Bool

:-1: Undefined symbol: protocol descriptor for Swift.Error

:-1: Undefined symbol: Swift.print(_: Any..., separator: Swift.String, terminator: Swift.String) -> ()

:-1: Undefined symbol: type metadata for Any

:-1: Undefined symbol: __swift_FORCELOAD$_swiftCoreFoundation

:-1: Undefined symbol: __swift_FORCELOAD$_swiftCoreGraphics

:-1: Undefined symbol: __swift_FORCELOAD$_swiftCoreImage

:-1: Undefined symbol: __swift_FORCELOAD$_swiftDarwin

:-1: Undefined symbol: __swift_FORCELOAD$_swiftDispatch

:-1: Undefined symbol: __swift_FORCELOAD$_swiftFoundation

:-1: Undefined symbol: __swift_FORCELOAD$_swiftMetal

:-1: Undefined symbol: __swift_FORCELOAD$_swiftObjectiveC

:-1: Undefined symbol: __swift_FORCELOAD$_swiftQuartzCore

:-1: Undefined symbol: __swift_FORCELOAD$_swiftUIKit

:-1: Undefined symbol: _swift_allocObject

:-1: Undefined symbol: _swift_beginAccess

:-1: Undefined symbol: _swift_bridgeObjectRelease

:-1: Undefined symbol: _swift_bridgeObjectRetain

:-1: Undefined symbol: _swift_deallocObject

:-1: Undefined symbol: _swift_dynamicCast

:-1: Undefined symbol: _swift_endAccess

:-1: Undefined symbol: _swift_errorRelease

:-1: Undefined symbol: _swift_errorRetain

:-1: Undefined symbol: _swift_getExistentialTypeMetadata

:-1: Undefined symbol: _swift_getInitializedObjCClass

:-1: Undefined symbol: _swift_getObjCClassFromMetadata

:-1: Undefined symbol: _swift_getObjCClassMetadata

:-1: Undefined symbol: _swift_getTupleTypeMetadata2

:-1: Undefined symbol: _swift_getWitnessTable

:-1: Undefined symbol: _swift_isaMask

:-1: Undefined symbol: _swift_release

:-1: Undefined symbol: _swift_retain

:-1: Undefined symbol: _swift_unknownObjectRelease

:-1: Undefined symbol: _swift_unknownObjectRetain

`

Could you please add the latest swift version of Adyen and help with the above issue.

mkharibalaji commented 5 years ago

I was able to successfully make the adyen ios to work :)

First of all update your react native to version > 0.59.3 and then follow the below steps

Here are the Steps for XCode 10.2.1 & above

1) Your PodFile should look like ,

platform :ios, '11.0' use_frameworks! target 'Your Target Name' do pod 'AdyenReactNative', :path => '../node_modules/adyen-react-native' end

'pod update' would add these libraries ,

Installing Adyen 2.8.3 (was 2.8.1) Installing Adyen3DS2 2.1.0-rc.1 (was 0.9.6) Installing AdyenInternal 2.8.3 (was 2.8.1) Using AdyenReactNative (1.2.0)

2) Add the implementation for PaymentControllerDelegate in AdyenReactNative.swift which was missing as per the new migration given below

https://github.com/Adyen/adyen-ios/blob/master/MIGRATION.md

func provideAdditionalDetails(_ additionalDetails: AdditionalPaymentDetails, for paymentMethod: PaymentMethod, detailsHandler: @escaping Completion<[PaymentDetail]>){ }

3) Modify the OS Version for AdyenReactNativeProject to 11.3 to avoid armv7 missing architecture

4) Replace the Adyen framework in your nodemodules ios folder with the newly swift 5 compiled version from the Pods to /node_modules/adyen-react-native/ios like below

image

5) Link the project manually

6) As per the facebook link below create a empty swift file and create the bridege in your parent RN project,

image image

Thats it you should be able to get the adyen working in iOS.

GituBojan commented 5 years ago

3.0.0 was released on 18th of June.

Can you create a PR for 2.8.4 with your changes?

mkharibalaji commented 5 years ago

@GituBojan added a Pull request and I have also created a issue for 3.0.0 release as well.

GituBojan commented 5 years ago

Installing Adyen 2.8.3 (was 2.8.1) Installing Adyen3DS2 2.1.0-rc.1 (was 0.9.6) Installing AdyenInternal 2.8.3 (was 2.8.1) Using AdyenReactNative (1.2.0)

I could only find Adyen3Ds2 in the pods folder. Adyen, AdyenInternal pods are installed but there is no .framework file inside the pods folders.

By linking them manually you mean a second link within the Linked Frameworks and Libraries even if we install the pod file?

mkharibalaji commented 5 years ago

@GituBojan

image

Copy Adyen3DS2 from Pods/Adyen3DS2/Frameworks and then Copy from Products Folder Adyen.Framework,AdyenInternal.framework and AdyenInternal.bundle

jrwpatterson commented 5 years ago

@mkharibalaji do you know how to apply your fixes to the RN60 autolinker... if I manually link it can't find the react bridge... if I don't there's no module...

mkharibalaji commented 5 years ago

@jrwpatterson - Working on it.

voslartomas commented 5 years ago

@mkharibalaji I have same problem as @GituBojan can't see Adyen.framework not either AdyenInternal.framework, build is without errors. But when I run app and include adyen-react-native I get error with native module.

voslartomas commented 5 years ago

@mkharibalaji Anything new?

jannisch commented 5 years ago

I figured out that this error message doesn't have anything to do with architectures, the framework search paths are just wrong

Try setting these paths on the AdyenReactNative target Screenshot 2019-09-29 at 16 12 59

After that Adyen.framework should be compiled and end up in the build directory. If AdyenInternal can't be found from the Adyen module, add "${BUILD_DIR}/AdyenInternal" to the Adyen search paths as far as I remember.

mkharibalaji commented 5 years ago

Hi @jannisch, You are correct !!! I tried several times even cearing of the xcode 10.2 cache but still recieving this error and thats why went on with Manual reference. Those who are trying with react native > 0.60,please try @jannisch way of setting the Path in Xcode.

mkharibalaji commented 5 years ago

@voslartomas - Please try @jannisch way...

mkharibalaji commented 5 years ago

@jannisch - Can you raise a PR for the Path Fix ??

jannisch commented 5 years ago

@mkharibalaji sure I'll submit a PR as soon as I got time and try everything step by step. So far it only works with the quickstart repo (0.59) react-native 0.61 even builds automatically and compiles Adyen, however I get the Native module cannot be null error from the first post in this thread. Please let me know if you have any ideas how to fix this

VladYakut commented 5 years ago

@jannisch have you found the solution?

mkharibalaji commented 5 years ago

Hi @jannisch @voslartomas @jrwpatterson VladYakut,

Sorry for the late response.I was busy with other work. update the AdyenReactNative.podspec file with this for RN 0.60 and do a 'pod install' it should work.

`` require 'json' package = JSON.parse(File.read('package.json'))

Pod::Spec.new do |s|

s.name = "AdyenReactNative" s.version = package["version"] s.summary = package["description"]

s.homepage = "https://github.com/dmitry-blackwave/adyen-react-native#readme" s.license = "MIT" s.author = { "author" => "dmitry@belov.dev" }

s.platform = :ios, "11.0" s.source = { :git => "https://github.com/author/AdyenReactNative.git" } s.source_files = "ios/*.{h,m,swift}" s.requires_arc = true

s.dependency "React" s.dependency "Adyen","2.8.5" s.dependency "Adyen/ApplePay","2.8.5"

end ``

In the meanwhile I will raise a PR for this.