在flutter中安装原生iOS pod

nim*_*112 7 ios cocoapods flutter flutter-dependencies flutter-plugin

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

我尝试使用的 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 = true.podspecuse_frameworks!podfile。现在pod install运行成功,

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

    error: include of non-modular header inside framework module

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

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

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

小智 1

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

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