[英]How can i add pod(third party framework) into my custom cocoa touch framework?
I'm creating a new Cocoa Touch Framework (MyFramework.framework), which will have a dependency on Alamofire.我正在创建一个新的 Cocoa Touch 框架 (MyFramework.framework),它将依赖于 Alamofire。 This framework will be written in Swift.
这个框架将用 Swift 编写。 As a test I started a new Cocoa Touch Framework project:
作为测试,我开始了一个新的 Cocoa Touch Framework 项目:
File > New > Project > Framework & Library > Cocoa Touch Framework
Then, in the terminal I performed:然后,在我执行的终端中:
pod init
under this projects directory.在这个项目目录下。 In the newly created Podfile I added the following:
在新创建的 Podfile 中,我添加了以下内容:
// Uncomment this line to define a global platform for your project // 取消注释这一行,为您的项目定义一个全球平台
platform :ios, '9.0'
// Uncomment this line if you're using Swift // 如果您使用 Swift,请取消注释此行
use_frameworks!使用_框架!
pod 'Alamofire'
Once again, in the Terminal I performed:再一次,在终端中,我执行了:
pod install吊舱安装
and started coding away.并开始编码。
Everything seemed well and good till I used the MyFramework.framework Product in a Single View Project.在我在单视图项目中使用 MyFramework.framework 产品之前,一切看起来都很好。 When I attempt to run the project I get the following issue:
当我尝试运行该项目时,出现以下问题:
dyld: Library not loaded: @rpath/testfm.framework/MyFramework
Referenced from: /var/containers/Bundle/Application/D4456F6A-2EBB-4AF9-B974-37A66E42D374/test.app/test
Reason: image not found原因:找不到图片
please let me know if you need more information.如果您需要更多信息,请告诉我。
Try to Embed MyFramework.framework into Build phase -> Embed Framework.尝试将 MyFramework.framework 嵌入到构建阶段 -> 嵌入框架。 like @Vishnu suggested.
就像@Vishnu 建议的那样。
Following Steps May be Help.
以下步骤可能会有所帮助。
.xcworkspace
File.xcworkspace
文件.xcodeproj
Just remove the pod from the project.xcodeproj
只需从项目中删除 podFile -> New -> File -> Select the Empty File.
File -> New -> File -> Select the Empty File.
save File with Podfile
name.Podfile
名称保存文件。 (Must save the Project in main Directory). Terminal
and Drag and drop Podfile
and install the pod again.Terminal
并拖放Podfile
并再次安装 Pod。.xcodeproj
and open the .xcworkspace
file..xcodeproj
并打开.xcworkspace
文件。 Hope this Works.希望这有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.