首页 > 解决方案 > 模块RNPaypalWrapper错误Apple-Mach-O链接器反应本机错误

问题描述

嘿伙计们,我在安装 react native payola wrapper 后制作了一个 react native 应用程序,我面临这个问题

  1. 模块 RNPaypalWrapper 需要主队列设置,因为它覆盖constantsToExport但没有实现requiresMainQueueSetup. 在未来的版本中,React Native 将默认在后台线程上初始化所有本机模块,除非明确选择退出。

  2. Apple-Mach-O 链接器错误

 Ld /Users/mac/Library/Developer/Xcode/DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Products/Debug-iphonesimulator/Shopping.app/Shopping

正常 x86_64 cd /Users/mac/Desktop/Tanveer/Tabtest/Shopping/ios export IPHONEOS_DEPLOYMENT_TARGET=9.0 export PATH="/Applications/Xcode_9.4.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin: /Applications/Xcode_9.4.1.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode_9.4.1.app/Contents /Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode_9.4.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4。sdk -L/Users/mac/Library/Developer/Xcode/DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Products/Debug-iphonesimulator -L/Users/mac/Desktop/Tanveer/Tabtest/Shopping/ios/Pods/CardIO/CardIO - L/Users/mac/Desktop/Tanveer/Tabtest/Shopping/ios/Pods/PayPal-iOS-SDK/PayPalMobile-F/Users/mac/Library/Developer/Xcode/DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Products/Debug- iphonesimulator -filelist /Users/mac/Library/Developer/Xcode/DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Intermediates.noindex/Shopping.build/Debug-iphonesimulator/Shopping.build/Objects-normal/x86_64/Shopping.LinkFileList -Xlinker - rpath -Xlinker @executable_path/Frameworks -mios-simulator-version-min=9.0 -Xlinker -object_path_lto -Xlinker /Users/mac/Library/Developer/Xcode/DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Intermediates。noindex/Shopping.build/Debug-iphonesimulator/Shopping.build/Objects-normal/x86_64/Shopping_lto.o -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -ObjC -lCardIO -lPayPalMobile -lc++ -lopencv_core -lopencv_imgproc -framework AVFoundation -framework Accelerate -framework AudioToolbox -framework CoreLocation -framework CoreMedia -framework CoreVideo -framework MessageUI -framework MobileCoreServices -framework OpenGLES -framework QuartzCore -framework Security -framework SystemConfiguration -framework UIKit -ObjC -lc++ - Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/mac/Library/Developer/Xcode/DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Intermediates.noindex/Shopping.build/Debug-iphonesimulator/Shopping.build/Shopping.app-模拟。xcent /Users/mac/Library/Developer/Xcode/DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Products/Debug-iphonesimulator/libRCTBlob.a /Users/mac/Library/Developer/Xcode/DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Products/ Debug-iphonesimulator/libRCTAnimation.a /Users/mac/Library/Developer/Xcode/DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Products/Debug-iphonesimulator/libReact.a /Users/mac/Library/Developer/Xcode/DerivedData/Shopping- bffzrhylanxuelcazupfwylbgyoq/Build/Products/Debug-iphonesimulator/libRCTAnimation.a /Users/mac/Library/Developer/Xcode/DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Products/Debug-iphonesimulator/libRCTActionSheet.a /Users/mac/Library/Developer/ Xcode/DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Products/Debug-iphonesimulator/libRCTGeolocation。a /Users/mac/Library/Developer/Xcode/DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Products/Debug-iphonesimulator/libRCTImage.a /Users/mac/Library/Developer/Xcode/DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Products/ Debug-iphonesimulator/libRCTLinking.a /Users/mac/Library/Developer/Xcode/DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Products/Debug-iphonesimulator/libRCTNetwork.a /Users/mac/Library/Developer/Xcode/DerivedData/Shopping- bffzrhylanxuelcazupfwylbgyoq/Build/Products/Debug-iphonesimulator/libRCTSettings.a /Users/mac/Library/Developer/Xcode/DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Products/Debug-iphonesimulator/libRCTText.a /Users/mac/Library/Developer/ Xcode/DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Products/Debug-iphonesimulator/libRCTVibration。a /Users/mac/Library/Developer/Xcode/DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Products/Debug-iphonesimulator/libRCTWebSocket.a -lRNImagePicker -lRNPaypalWrapper -lPods-Shopping -Xlinker -dependency_info -Xlinker /Users/mac/Library/ Developer/Xcode/DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Intermediates.noindex/Shopping.build/Debug-iphonesimulator/Shopping.build/Objects-normal/x86_64/Shopping_dependency_info.dat -o /Users/mac/Library/Developer/Xcode/ DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Products/Debug-iphonesimulator/Shopping.app/Shoppinga -lRNImagePicker -lRNPaypalWrapper -lPods-Shopping -Xlinker -dependency_info -Xlinker /Users/mac/Library/Developer/Xcode/DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Intermediates.noindex/Shopping.build/Debug-iphonesimulator/Shopping.build/对象-normal/x86_64/Shopping_dependency_info.dat -o /Users/mac/Library/Developer/Xcode/DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Products/Debug-iphonesimulator/Shopping.app/Shoppinga -lRNImagePicker -lRNPaypalWrapper -lPods-Shopping -Xlinker -dependency_info -Xlinker /Users/mac/Library/Developer/Xcode/DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Intermediates.noindex/Shopping.build/Debug-iphonesimulator/Shopping.build/对象-normal/x86_64/Shopping_dependency_info.dat -o /Users/mac/Library/Developer/Xcode/DerivedData/Shopping-bffzrhylanxuelcazupfwylbgyoq/Build/Products/Debug-iphonesimulator/Shopping.app/Shopping

 ld: library not found for -lPods-Shopping
    clang: error: linker command failed with exit code 1 (use -v to see          invocation)

我该如何解决这些错误......

标签: iosxcodereact-nativepaypalreact-native-ios

解决方案


这些是软件包的安装说明,请仔细执行每一步。

  1. npm install --save react-native-paypal-wrapper 或 yarn add react-native-paypal-wrapper
  2. react-native 链接 react-native-paypal-wrapper
  3. 克隆这个 repo(你不需要下载这个 repo 中的所有组件)

  4. 将 PayPal Mobile 目录(包含几个 .h 文件和 libPayPalMobile.a)添加到您的 Xcode 项目中。我们建议检查“复制项目...”并选择“创建组...”。

  5. 在项目的构建设置中(在 TARGETS 部分,而不是 PROJECTS 部分):
add -lc++ -ObjC to Other Linker Flags
enable Enable Modules (C and Objective-C)
enable Link Frameworks Automatically
  1. 在您的项目的构建阶段,将您的项目与这些库链接。支持返回 6.0 的 iOS 版本的弱链接。
Accelerate.framework
AudioToolbox.framework
AVFoundation.framework
CoreLocation.framework
CoreMedia.framework
MessageUI.framework
MobileCoreServices.framework
SystemConfiguration.framework
SafariServices.framework
  1. 将 acknowledgments.md 中的开源许可证确认添加到应用程序的确认中。

  2. 在您应用的 Info.plist 中,将以下 URL 方案添加到 LSApplicationQueriesSchemes:

com.paypal.ppclient.touch.v1
com.paypal.ppclient.touch.v2
org-appextension-feature-password-management

注意:这些安装说明是从react-native-paypal-wrapper收集的,并且因为它建议了paypal ios sdk 文档,它们非常适合我们的项目


推荐阅读