【发布时间】:2020-05-07 17:58:18
【问题描述】:
更多信息
- 我也在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
我的播客文件:
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看到我的cmets@
顺便说一句,在“将二进制文件与库链接”下,我有两个包条目:
- 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
【问题讨论】:
-
如果你正在运行 rn 0.60+,应用程序应该自动链接大多数 rn 依赖项,但是在 60+ 之前你需要手动链接它。
-
我知道,我做到了,谢谢!
-
有没有帮助? - 下面的答案也有帮助吗?
-
没有。刚刚在我的问题底部添加了几行关于它的内容。
-
你能帮我们一个忙,做一个最小的回购(没有别的,只是能够在一个单独的示例回购中重现这个错误)——我们需要永远设置一些不会与您的 RN 设置相同
标签: xcode react-native-ios square