无法导入随Cocoapods安装的依赖项 [英] Can't import dependency installed with Cocoapods
问题描述
我已将FBSDK与Cocoapods一起安装,但由于某种原因无法将其导入AppDelegate.swift文件中。 FBSDK工具包出现在我的Xcode项目中,因此我认为它应该可以工作。
无论如何我不是iOS开发人员,我只是想写一个简单的Flutter SDK的本机插件。有人有主意吗?
-这是pod文件的样子-
#取消注释该行即可为您的项目定义一个全局平台
#platform:ios,'9.0'
如果ENV ['FLUTTER_FRAMEWORK_DIR' ] == nil
abort('请将FLUTTER_FRAMEWORK_DIR设置为包含Flutter.framework的目录')
结束
目标'Runner'做
use_frameworks!
#转轮荚
荚'FBSDKCoreKit'
荚'FBSDKLoginKit'
荚'FBSDKShareKit'
#颤抖荚
pod'Flutter',:path => ENV ['FLUTTER_FRAMEWORK_DIR']
如果File.exists存在? ’../.flutter-plugins’
flutter_root = File.expand_path(’。’’)
File.foreach(’../。flutter-plugins’){| line |
plugin = line.split(pattern ='=')
if plugin.length == 2
名称= plugin [0] .strip()
路径= plugin [1 ] .strip()
resolve_path = File.expand_path(#{path} / ios,flutter_root)
窗格名称,:path => resolve_path
else
放置无效的插件规范:#{line}
结束
}
结束
结束
安装后做|安装程序|
installer.pods_project.targets.each做| target |
target.build_configurations.each | config |
config.build_settings ['ENABLE_BITCODE'] ='否'
结束
结束
结束
---编辑---
我收到以下错误atm: FBSDKCoreKit.framework:没有这样的文件或目录
。当我在xCode中打开Frameworks文件夹时,所有文件名均为红色:
,但是Finder中的确切文件夹为空。所以我想这就是错误出现的原因。问题是如何解决此问题...
这是我的嵌入式二进制文件
和链接的框架和库
在项目中看起来像:
I've installed FBSDK with Cocoapods but can't import it in my AppDelegate.swift file for some reason. The FBSDK kit appears in my Xcode project so I feel like it should be working.
I'm not an iOS developer by any means, I'm just trying to write a simple native plugin for Flutter SDK. Anyone an idea?
--Here is what the pod file looks like--
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
if ENV['FLUTTER_FRAMEWORK_DIR'] == nil
abort('Please set FLUTTER_FRAMEWORK_DIR to the directory containing Flutter.framework')
end
target 'Runner' do
use_frameworks!
# Pods for Runner
pod 'FBSDKCoreKit'
pod 'FBSDKLoginKit'
pod 'FBSDKShareKit'
# Flutter Pods
pod 'Flutter', :path => ENV['FLUTTER_FRAMEWORK_DIR']
if File.exists? '../.flutter-plugins'
flutter_root = File.expand_path('..')
File.foreach('../.flutter-plugins') { |line|
plugin = line.split(pattern='=')
if plugin.length == 2
name = plugin[0].strip()
path = plugin[1].strip()
resolved_path = File.expand_path("#{path}/ios", flutter_root)
pod name, :path => resolved_path
else
puts "Invalid plugin specification: #{line}"
end
}
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
---EDIT---
I''m getting the following error atm: FBSDKCoreKit.framework: No such file or directory
.When I open the Frameworks folder in xCode, all file names are in red:
But that exact folder in Finder is empty. So I guess that's why the error is showing. The question is how to fix this...
This is what my embedded binaries
and linked frameworks and libraries
look like in the project:
- Select your Project Target
- Go to Build Settings.
- Search for Header Search Paths.
- Add this value $(SRCROOT)/Pods with recursive, then Xcode will resolve the path for you.
这篇关于无法导入随Cocoapods安装的依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!