naoufal / react-native-payments

Accept Payments with Apple Pay and Android Pay using the Payment Request API.
https://www.npmjs.com/package/react-native-payments
1.59k stars 413 forks source link

null is not an object (evaluating 'ReactNativePayments.createPaymentRequest') #186

Closed alexeyz-PE closed 5 years ago

SainiJii commented 5 years ago

Hello @alexeyz-PE , I was facing the same issue. I did one thing to solve this issue, I know that's not the correct and good programming practice but solved my issue: I just copied and paste following files from "node_modules/react-native-payments/lib/ios/" to my project folder in xcode:

GatewayManager.h GatewayManager.m ReactNativePayments.h ReactNativePayments.m and Complete "Views" Folder

See screenshots below:

Screen Shot 2019-09-22 at 23 27 24 Screenshot 2019-09-22 at 11 00 35 AM

Edit: I think, I got the proper solution. Actually there is a problem with "ReactNativePayments.podspec" file, follow the below steps:

  1. Run npm install react-native-payments --save command
  2. Open "ReactNativePayments.podspec" file and some changes (Refer screenshot below)

Screenshot 2019-09-23 at 12 52 21 PM

  1. Then run link command react-native link react-native-payments
  2. Go to ios folder and run following command "pod cache clean --all" and "pod install"

Please let me know if those solution help you.

Thanks Alankar Saini

ramisalem commented 4 years ago

@SainiJii what is the path of ReactNativePayments.podspec file?

harbolaez commented 3 years ago

@SainiJii I try that, but still the same issue. I see a few people have succeed, do you think is applicable in version 0.8.2? This is my changes

require 'json'
pkg = JSON.parse(File.read("package.json"))
version = pkg["version"]
giturl = pkg["repository"]["url"]

Pod::Spec.new do |s|
  s.name             = pkg["name"]
  s.version          = pkg["version"]
  s.summary          = pkg["description"]
  s.requires_arc     = true
  s.license          = pkg["license"]
  s.homepage         = pkg["homepage"]
  s.author           = pkg["author"]
  s.source           = { :git => pkg["repository"]["url"] }
  s.source_files     = 'lib/ios/*.{h,m}'
  s.platform         = :ios, "8.0"
  s.requires_arc     = true

  s.dependency 'React'
  s.dependency 'Stripe'
  s.dependency 'Braintree'
end