[英]Using Cocoapods libraries in Flutter iOS platform specific code
我正在尝试使用Cocoapods库(用于外部SDK),但是我没有找到任何文档来做到这一点。 我已经通过将一行添加到Gradle
文件中将其集成到Android部分中。
简而言之,我想创建一个podfile
(或找到它),在其中可以添加依赖项并在AppDelegate.swift
文件中使用它。
到目前为止,我尝试的是在ios/
文件夹中运行pod init
,然后添加我的pod(例如pod 'Charts'
)并运行pod install
但是它说:
[!] CocoaPods未设置项目的基本配置,因为您的项目已具有自定义配置集。 为了使CocoaPods集成完全起作用,请将目标
Runner
的基本配置设置为Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig
或包含Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig
在构建配置中(Flutter/Release.xcconfig
)。
然后,当我尝试在Xcode上构建时,它给了我这个错误:
错误:沙箱与Podfile.lock不同步。 运行“ pod install”或更新您的CocoaPods安装。
我想我做对了,但Flutter.io文档没有任何帮助。
在此先感谢您的帮助!
在ios/
文件夹中运行pod init
和pod install
之后,添加
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
到ios/Flutter/Debug.xcconfig
并添加
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"
到ios/Flutter/Release.xcconfig
您是否将项目目标添加到Podfile
? 像这样:
def swift_frameworks
pod 'PodName', 'X.X'
end
target 'My Project' do
swift_frameworks
end
只需将您的Pod放在ios
文件夹下的Podfile
文件的末尾Podfile
,例如:
pod 'UMCAnalytics'
默认情况下,此文件中包含一些代码,但只需忽略它们,然后将您的广告连播添加到它们下面即可。 之后,运行:
pod update
然后您将看到已安装的吊舱。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.