首页 > 解决方案 > 在 Flutter 中安装原生 iOS pod

问题描述

我在使用 pod 时在 iOS 端制作颤振插件时遇到错误。吊舱安装成功,然后我也可以将它们导入文件中。

我尝试使用的 pod 是Freshchat iOS SDK

我安装 pod 所遵循的步骤

  1. 启动一个新的 Flutter 插件项目。

  2. .podspec文件中添加s.dependency 'FreshchatSDK'

  3. pod installexample/ios文件夹中运行。

    我有一个错误

    The 'Pods-Runner' target has transitive dependencies that include statically linked binaries: (/Users/nimish/FlutterProjects/freshchat_flutter/freshchat_flutter/example/ios/Pods/FreshchatSDK/FreshchatSDK/libFDFreshchatSDK.a)

  4. use_frameworks!不再podfile关注此评论

  5. pod install再次运行,成功安装了 pod,并Pods创建了包含FreshchatSDK文件夹的文件夹。

现在我需要use_frameworks!在我的项目中拥有,因为其他插件因此没有编译。

  1. 我添加了s.static_framework = truein.podspecuse_frameworks!in podfile。现在pod install运行成功了,

  2. #import "FreshchatSDK.h"在我的文件中添加导入后,Plugin.h我收到了错误

    error: include of non-modular header inside framework module

我尝试了这个答案,但无法解决。

请帮我解决这个问题。我会尊重你的时间。

这里还有另一个颤振插件可用但它有很多问题,一个未处理的案例使我的 iOS 应用程序崩溃,所以我想把它变成我自己的。

标签: iosfluttercocoapodsflutter-dependenciesflutter-plugin

解决方案


由于 Target 不匹配,PodFile 中可能存在问题。当这种情况发生在我身上时,我使用了这些简单的步骤。

  1. 删除 Podfile
  2. 在特定文件中打开终端
  3. Pod init
  4. 打开 Podfile 并添加依赖项
  5. Pod install

推荐阅读