OGeek|极客世界-中国程序员成长平台

标题: iOS 库找不到标题 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 19:29
标题: iOS 库找不到标题

我正在尝试将 Segment 分析与 React Native 包装器库 (react-native-segment-analytics) 集成。核心 Segment iOS 库已添加为 Pod(使用 use_frameworks!);我已将 SegmentAnalytics.xcodeproj 放入 Libraries/ 的包装库。

我遇到的错误是

.../node_modules/react-native-segment-analytics/ios/SegmentAnalytics/Classes/SegmentAnalytics.m:7:9: fatal error: 'Analytics/SEGAnalytics.h' file not found

有问题的行是

#import

Libraries

SEGAnalytics.h

我很确定这不是 Segment 所特有的,但我把它留在这里以防万一。

header 在项目中可用。事实上,我可以在项目根目录的源文件中添加相同的 #import 并且它可以很好地解决。我能辨别的唯一区别是包装库是嵌入式 xcodeproj。

似乎每个 Xcode 配置选项都试图解决这个问题,包括尝试不同的 header 搜索路径和框架搜索路径,尝试将 Segment 库作为链接的二进制文件添加到我能想到的任何地方,甚至将导入从 <> 更改为 ""语法。

感谢任何帮助。

编辑:使用的库:

Edit2:添加了一些文本以尝试阐明 Segment 与 react-native-segment-analytics 库的对比。

https://github.com/segmentio/analytics-ios

https://github.com/charlires/react-native-segment-analytics



Best Answer-推荐答案


尝试使用安装instructions来自这个库的开发者:

Installation

  1. Download and install the npm package by running npm install --save react-native-segment-io-analytics
  2. In your Podfile, add pod "Analytics" to your project and run pod install in your ios folder
  3. Inside Xcode (make sure you've opened your .xcworkspace file), go to the project navigator and right click Libraries -> Add Files to [your project's name].
  4. Go to node_modules -> react-native-segment-io-analytics -> and choose the RNSegmentIOAnalytics.xcodeproj file. Make sure your project links to libAnalytics.a and libRNSegmentIOAnalytics.a (The libraries should be listed under "Build Phases -> Link Binary With Libraries").

您可能错过了一些步骤。

关于iOS 库找不到标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43399270/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4