【发布时间】:2017-12-02 03:52:43
【问题描述】:
我已经使用 Cocoapods 安装了 FBSDK,但由于某种原因无法将其导入我的 AppDelegate.swift 文件中。 FBSDK 套件出现在我的 Xcode 项目中,所以我觉得它应该可以工作。
无论如何,我都不是 iOS 开发者,我只是想为 Flutter SDK 编写一个简单的原生插件。有人有想法吗?
--这是 pod 文件的样子--
# 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
---编辑---
我收到以下错误 atm:FBSDKCoreKit.framework: No such file or directory。当我在 xCode 中打开 Frameworks 文件夹时,所有文件名都是红色的:
但 Finder 中的确切文件夹是空的。所以我想这就是显示错误的原因。问题是如何解决这个问题......
这是我的embedded binaries 和linked frameworks and libraries 在项目中的样子:
【问题讨论】:
-
请检查我从这个线程stackoverflow.com/a/44787352/3632832的回答
-
将框架添加到嵌入式二进制文件。
-
@KKRocks 如何做到这一点?
-
选择项目目标,你可以在那里看到这个选项。
-
@KKRocks 我在“构建阶段”下的 Pods 项目中找到了它,但在我的 Runner 项目中似乎找不到它。就像我说的,我只是想制作一个插件。该项目是预先创建的,所以可能有点奇怪:/
标签: ios swift xcode cocoapods flutter