如何将 CocoaPod 框架添加到 Xcode 8 Playground
How to add a CocoaPod framework to Xcode 8 Playground
我试图在 Xcode 项目中向 Playground 添加一些 pods。不幸的是,更新后唯一支持的范围是目标,不再支持 link_with
。
错误:
[!] Invalid Podfile
file: [!] The specification of link_with
in the Podfile is now unsupported, please use target blocks instead.
当我使用目标块时,出现此错误:
[!] Unable to find a target named MyPlayground
, did find Target_1
, Target_2
或:
[!] Unable to find a target named MyPlayground.playground
, did find Target_1
, Target_2
还尝试在 Target_1
target
范围内添加它:
错误
[!] Invalid Podfile
file: [!] Unsupported options MyPlayground
for target Target_1
.
向 Playground 源添加依赖项的最简单方法是什么?
更新
截至:
Xcode 8.2
您不再需要将 pod 文件夹添加到资源中,只需像在项目中一样使用它。
示例:
Pre Xcode 8.1
感谢Eric Aya
,我根据他的第一个建议找到了解决方案。
要将 CocoPods 框架添加到 Playground
,请按照下列步骤操作:
- 将 pods 添加到您的 pod 文件并点击
pod install
- 添加新的 Playground 文件
- 单击 playground 中的
Sources
文件夹
- 点击
Add Files to Sources
的 +
- 添加你的 pod 文件夹,在我们的例子中
HanakeSwift
- 导入你的项目pods框架
import Pods_PodsPlayground
- 构建并访问您的框架!
Step 3
Step 4
Step 5
Step 6, 7
在 Xcode 8.2:
- 点击左栏中的项目名称
- 单击 "New File" 并选择 "Playground"
- 导入您在 Podfile 中安装的 pod
- 如果暂时找不到 pod,可能会进行构建并运行 消除错误
- 就是这样!你应该可以开始了
我试图在 Xcode 项目中向 Playground 添加一些 pods。不幸的是,更新后唯一支持的范围是目标,不再支持 link_with
。
错误:
[!] Invalid
Podfile
file: [!] The specification oflink_with
in the Podfile is now unsupported, please use target blocks instead.
当我使用目标块时,出现此错误:
[!] Unable to find a target named
MyPlayground
, did findTarget_1
,Target_2
或:
[!] Unable to find a target named
MyPlayground.playground
, did findTarget_1
,Target_2
还尝试在 Target_1
target
范围内添加它:
错误
[!] Invalid
Podfile
file: [!] Unsupported optionsMyPlayground
for targetTarget_1
.
向 Playground 源添加依赖项的最简单方法是什么?
更新
截至:
Xcode 8.2
您不再需要将 pod 文件夹添加到资源中,只需像在项目中一样使用它。
示例:
Pre Xcode 8.1
感谢Eric Aya
,我根据他的第一个建议找到了解决方案。
要将 CocoPods 框架添加到 Playground
,请按照下列步骤操作:
- 将 pods 添加到您的 pod 文件并点击
pod install
- 添加新的 Playground 文件
- 单击 playground 中的
Sources
文件夹 - 点击
Add Files to Sources
的 +
- 添加你的 pod 文件夹,在我们的例子中
HanakeSwift
- 导入你的项目pods框架
import Pods_PodsPlayground
- 构建并访问您的框架!
Step 3
Step 4
Step 5
Step 6, 7
在 Xcode 8.2:
- 点击左栏中的项目名称
- 单击 "New File" 并选择 "Playground"
- 导入您在 Podfile 中安装的 pod
- 如果暂时找不到 pod,可能会进行构建并运行 消除错误
- 就是这样!你应该可以开始了