链接lottie-ios后编译错误

时间:2018-11-13 01:31:48

标签: ios react-native lottie

我尝试链接lottie-ios,但是出现编译错误。 Lottie与android模拟器配合正常。

这是我所做的: 1. npm我-保存lottie-react-native@2.3.2 2. react-native链接lottie-ios 3.反应本地链接lottie-反应本地 4.之后,打开Xcode项目配置,并将Lottie.framework添加为Embedded Binaries

从这个开始,我有多个编译错误:

/Users/user/Code/CSULB/CECS_543/anacodiam_ios/node_modules/lottie-react-native/src/ios/../../../react-native/ReactCommon/fabric/graphics/platform/ios/float.h:8:10: fatal error: "limits" file not found
    #include <limits>
    While building module "UIKit" imported from /Users/user/Code/CSULB/CECS_543/anacodiam_ios/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTViewManager.h:8:
    While building module "Foundation" imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8:
    In file included from <module-includes>:1: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:10: fatal error: could not build module "CoreFoundation"
    #include <CoreFoundation/CoreFoundation.h>

我的React本机版本:

react-native -V
0.57.4

屏幕截图 这是我的项目设置(文件>项目设置): https://imgur.com/MgyNqDj

我的常规设置: https://imgur.com/HoghSUA

我的标题搜索路径:https://imgur.com/Hd5ngHh

我按照本期Github的要求添加了$(SRCROOT)/../node_modules/react-native/React/

我的构建阶段: https://imgur.com/cg630rS

谢谢。

1 个答案:

答案 0 :(得分:1)

正如Anhtu所说,自动链接可能会中断。 另外,我有一个相同的编译问题:您应该将lottie-react-native更新到最新版本(目前为2.5.9),他们修复了他们的iOS项目header search path设置。

在2.5.8版中,他们的项目使用递归选项引用了React文件夹,这导致CodeFoundation构建错误。 (这以前是ReactNative推荐的,但自https://facebook.github.io/react-native/docs/linking-libraries-ios起已更改) 他们从2.5.9版本开始删除了header search path,现在这个CoreFoundation错误已经消失了!