如何将react-native-vector-icons链接到项目

时间:2016-02-10 13:58:34

标签: ios xcode react-native

我使用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 /箱:在/ 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-ddtqngxgxoergggtejjrwd qafazh / 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 / DerivedDat a / 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。应用程序/ NativeStarter

     

ld:找不到-lRNVectorIcons的库   clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)

2 个答案:

答案 0 :(得分:9)

我们更新了Native Starter Pro的文档。请查看常见问题解答

下的第一个问题

http://strapmobile.com/docs/native-starter-pro/faqs/

<强>概率:

  • 如果您的系统中安装了“npm3”,则可能会出现问题。
  • 确保您已安装'npm2'。
  • 在XCode中链接矢量图标repo将解决问题

解决方案1:拖放以链接RN矢量图标文件:

  • 在您的取景器/计算机中,导航至(项目文件夹) - &gt; node_modules - &gt;反应天然矢量-图标
  • 将RNVectorIcons.xcodeproj拖到侧栏中的Libraries,如下图所示 enter image description here

解决方案2:手动链接RN矢量图标文件:

  • 转到Xcode中的“Build Phases”
  • 点击“+”
  • 将二进制文件与库相关联
  • 点击“添加其他”
  • 导航到'NativeStarter'(项目文件夹) - &gt; node_modules - &gt;反应天然矢量-图标
  • 选择“RNVectorIcons.xcodeproj”
  • 清洁构建
  • 再次构建

答案 1 :(得分:4)

我所做的只是关注github中的文档。

我只是运行rnpm link并且无需手动操作。

请确保您已安装&#39; rnpm&#39;

npm install rnpm -g