我在使用 react-native-icons 时遇到构建错误。我从他们的 github 站点的安装说明中执行了链接命令。消息说图标已经链接到项目。
Ld /Users/rsanchez/Library/Developer/Xcode/DerivedData/NativeStarter-ddtqngxgxoergggtejjrwdqafazh/Build/Products/Debug-iphonesimulator/NativeStarter.app/NativeStarter normal x86_64 cd /Users/rsanchez/Development/NativeStarter.git/ios export IPHONEOS_DEPLOYMENT_TARGET=7.0 export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.2.sdk -L/Users/rsanchez/Library/Developer/Xcode/DerivedData/NativeStarter-ddtqngxgxoergggtejjrwdqafazh/Build/Products/Debug-iphonesimulator -F/Users/rsanchez/Library/Developer/Xcode/DerivedData/NativeStarter-ddtqngxgxoergggtejjrwdqafazh/Build/Products/Debug-iphonesimulator -filelist /Users/rsanchez/Library/Developer/Xcode/DerivedData/NativeStarter-ddtqngxgxoergggtejjrwdqafazh/Build/Intermediates/NativeStarter.build/Debug-iphonesimulator/NativeStarter.build/Objects-normal/x86_64/NativeStarter.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -mios-simulator-version-min=7.0 -Xlinker -objc_abi_version -Xlinker 2 -ObjC -fobjc-arc -fobjc-link-runtime -lRNVectorIcons /Users/rsanchez/Library/Developer/Xcode/DerivedData/NativeStarter-ddtqngxgxoergggtejjrwdqafazh/Build/Products/Debug-iphonesimulator/libReact.a /Users/rsanchez/Library/Developer/Xcode/DerivedData/NativeStarter-ddtqngxgxoergggtejjrwdqafazh/Build/Products/Debug-iphonesimulator/libRCTActionSheet.a /Users/rsanchez/Library/Developer/Xcode/DerivedData/NativeStarter-ddtqngxgxoergggtejjrwdqafazh/Build/Products/Debug-iphonesimulator/libRCTGeolocation.a /Users/rsanchez/Library/Developer/Xcode/DerivedData/NativeStarter-ddtqngxgxoergggtejjrwdqafazh/Build/Products/Debug-iphonesimulator/libRCTImage.a /Users/rsanchez/Library/Developer/Xcode/DerivedData/NativeStarter-ddtqngxgxoergggtejjrwdqafazh/Build/Products/Debug-iphonesimulator/libRCTLinking.a /Users/rsanchez/Library/Developer/Xcode/DerivedData/NativeStarter-ddtqngxgxoergggtejjrwdqafazh/Build/Products/Debug-iphonesimulator/libRCTNetwork.a /Users/rsanchez/Library/Developer/Xcode/DerivedData/NativeStarter-ddtqngxgxoergggtejjrwdqafazh/Build/Products/Debug-iphonesimulator/libRCTSettings.a /Users/rsanchez/Library/Developer/Xcode/DerivedData/NativeStarter-ddtqngxgxoergggtejjrwdqafazh/Build/Products/Debug-iphonesimulator/libRCTText.a /Users/rsanchez/Library/Developer/Xcode/DerivedData/NativeStarter-ddtqngxgxoergggtejjrwdqafazh/Build/Products/Debug-iphonesimulator/libRCTVibration.a /Users/rsanchez/Library/Developer/Xcode/DerivedData/NativeStarter-ddtqngxgxoergggtejjrwdqafazh/Build/Products/Debug-iphonesimulator/libRCTWebSocket.a -Xlinker -dependency_info -Xlinker /Users/rsanchez/Library/Developer/Xcode/DerivedData/NativeStarter-ddtqngxgxoergggtejjrwdqafazh/Build/Intermediates/NativeStarter.build/Debug-iphonesimulator/NativeStarter.build/Objects-normal/x86_64/NativeStarter_dependency_info.dat -o /Users/rsanchez/Library/Developer/Xcode/DerivedData/NativeStarter-ddtqngxgxoergggtejjrwdqafazh/Build/Products/Debug-iphonesimulator/NativeStarter.app/NativeStarter
ld: library not found for -lRNVectorIcons clang: error: linker command failed with exit code 1 (use -v to see invocation)
最佳答案
我们更新了 Native Starter Pro 的文档.请检查常见问题下的第一个问题
http://strapmobile.com/docs/native-starter-pro/faqs/
概率:
- 如果您的系统中安装了“npm3”,这可能就是问题所在。
- 确保您已安装“npm2”。
- 在 XCode 中链接 Vector Icons 存储库将解决问题
解决方案 1:拖放链接 RN 矢量图标文件:
- 在您的取景器/计算机中,导航到(项目文件夹)-> node_modules -> react-native-vector-icons
- 如下图所示,将 RNVectorIcons.xcodeproj 拖到边栏中的库中
解决方案 2:手动链接 RN 矢量图标文件:
- 转到 Xcode 中的“构建阶段”
- 点击“+”将二进制文件与库链接
- 点击“添加其他”
- 导航到“NativeStarter”(项目文件夹)-> node_modules -> react-native-vector-icons
- 选择“RNVectorIcons.xcodeproj”
- 清理构建
- 重新构建
关于ios - 如何将 react-native-vector-icons 链接到项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35317197/