我正在尝试使用 Cocoapods 库(用于外部 SDK),但我没有找到任何相关文档。我已经将它集成到 Android 部分,只需在 Gradle
文件中添加一行即可。
简单地说,我想创建(或者可能找到)一个podfile
,我可以在其中添加我的依赖项并在AppDelegate.swift
文件中使用它。
到目前为止我尝试的是在 ios/
文件夹中运行 pod init
然后添加我的 pod(例如 pod 'Charts'
)并运行 pod install
但它说:
[!] CocoaPods did not set the base configuration of your project because your project already has a custom config set. In order for CocoaPods integration to work at all, please either set the base configurations of the target
Runner
toPods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig
or include thePods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig
in your build configuration (Flutter/Release.xcconfig
).
然后当我尝试在 Xcode 上构建时,它给了我这个错误:
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
我认为我的做法是正确的,但我在 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
关于ios - 在 Flutter iOS 平台特定代码中使用 Cocoapods 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53630136/