xcode - React-native/iOS 应用程序 : Module 'SquareInAppPaymentsSDK' not found, 虽然它已添加到项目中

标签 xcode react-native-ios square

了解更多信息

  • 我也在 https://github.com/square/in-app-payments-react-native-plugin/issues/66#issuecomment-623619907 中发布了这个- 你可以在那里找到更多细节。
  • 我遇到问题的软件包的安装说明位于 https://github.com/square/in-app-payments-react-native-plugin/blob/master/docs/get-started.md

  • 总结问题
  • 我遇到的问题是我在 Xcode 中配置了一个 react-native 包( react-native-square-in-app-payments ),但我收到一条错误消息,提示“找不到模块 xxx”。

  • 问题是:
  • 为什么 Xcode 找不到“缺失”模块?什么配置不正确?我应该去哪里检查?

  • 错误如下
    Module 'SquareInAppPaymentsSDK' not found
    enter image description here

    我的播客文件:
    platform :ios, '11.0'
    
    target 'myproject' do
      use_frameworks!
    
      pod 'React', :path => '../node_modules/react-native'
      pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
      pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
      pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
      pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
    
      pod 'RNSquareInAppPayments', :path => '../node_modules/react-native-square-in-app-payments'
    
      post_install do |installer|
        installer.pods_project.targets.each do |target|
          if target.name == 'React'
            target.remove_from_project
          end
        end
      end
    
    end
    

    我的 project.pbxproj 文件(此处无法附加,但您可以在 github 中访问):

    https://github.com/square/in-app-payments-react-native-plugin/issues/66#issuecomment-625333601

    更新:链接(在第一条评论和@DenisTsoi 回答之后)下面

    我尝试了自动链接(如上所述,我需要它,因为我使用的是 RN 0.59.9),然后我再次开始并尝试手动链接,因为我都有同样的错误。您可以在 https://github.com/square/in-app-payments-react-native-plugin/issues/66#issuecomment-625330210 中查看我对此的评论。

    顺便说一句,在“将二进制文件与库链接”下,我有两个包条目:
  • SquareInAppPaymentsSDK.framework(根据 https://developer.squareup.com/docs/in-app-payments-sdk/installation#option-3-install-the-in-app-payments-sdk-manually 中的要求)
  • libRNSquareInApppayments.a(链接的一部分)

  • 在下面对@MuhammadNuman 的回答发表评论:

    我在一个新的 react-native 项目(由 react-init 创建)中尝试了你的 podfile。当我添加
    import { SQIPCore } from 'react-native-square-in-app-payments';
    

    我收到 https://github.com/square/in-app-payments-react-native-plugin/issues/66#issuecomment-629762613 中描述的错误

    你可以在 https://github.com/rahamin1/square_with-podfile 中找到我的 repo

    最佳答案

    我过去曾遇到过这种类型的错误。因为一些配置的东西丢失或损坏导致这些类型的问题。所以我给你的建议是创建一个新的 react-native 项目,从那里库的 NPM 或 GitHub 文档中一一安装 package.json 中的所有库。然后将代码从 src (React Code) 复制到新项目中。如果您在 ios 和 android 文件夹中有任何更改,则只需从文件中复制更改并粘贴到新项目 android/ios 文件夹的文件中。 (如果没有任何效果,那么应用这个解决方案。它总是对我有用)

    关于xcode - React-native/iOS 应用程序 : Module 'SquareInAppPaymentsSDK' not found, 虽然它已添加到项目中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61664567/

    相关文章:

    reactjs - React-Native 如何处理来自平面列表中项目的 onPress ???

    python - 在 Python 中对数字列表(或数组?)进行平方

    广场连接API : Retrieving all items within a category

    android - 使用 Cordova (Phonegap) 将 Xcode iPad 应用程序转换为 Android

    ios - 如何在 native react 中启用 ios 位置服务?

    ios - 尝试删除 UITableViewCell

    ios - native UI 组件引发不变违规 : tried to register two views with the same name FridgeCameraView

    ruby-on-rails - 将 Square 与 Rails 项目集成

    xcode - 单击文件夹/目录后,NSSavePanel崩溃

    iphone - 使用 xcode 和 tablecells 登录表单