简体   繁体   English

向Swift XCode项目添加Objective-C框架

[英]Adding an Objective-C framework to a Swift XCode project

I know this is a very simple - maybe obvious - question, but I've been struggling with it for a while. 我知道这是一个非常简单(也许很明显)的问题,但是我已经为此苦苦挣扎了一段时间。 I'm working on a SpriteKit project in XCode (using Swift) and I'm trying to add this SKEasing Framework from GitHub. 我正在使用XCode(使用Swift)开发SpriteKit项目,并且正在尝试从GitHub添加此SKEasing框架

I've already downloaded and extracted the zip file, and I did everything that 孙博弘answered including the bridging header (which I made the with the help of this site); 我已经下载并解压缩了zip文件,并做了孙博弘回答的所有内容,包括桥接标头(在站点的帮助下完成);

在此处输入图片说明

However, the framework doesn't seem to be working. 但是,该框架似乎无法正常工作。 I can't use any of the actions provided by this library. 我无法使用此库提供的任何操作。 Is there something I'm missing? 有什么我想念的吗? What am I doing wrong? 我究竟做错了什么?

You don't add the project to your project. 您没有将项目添加到您的项目。 First open the SKEasing project in xcode by itself. 首先自己在xcode中打开SKEasing项目。 Set the build target to generic iOS device. 将构建目标设置为通用iOS设备。 (With the pop up in the top left corner of the xocde project window.) Then use the Build command (under Product) and when that's done run Archive. (弹出窗口位于xocde项目窗口的左上角。)然后使用Build命令(在Product下),完成后运行Archive。 There should be a library built now under the products folder (left side of project window). 现在应该在产品文件夹下(项目窗口的左侧)建立一个库。 Control click on the library name and select Show in Finder. 控制单击库名称,然后选择“在Finder中显示”。 This will lead you to the library. 这将带您进入图书馆。 Copy this file to your project and you should be good to go. 将此文件复制到您的项目中,就可以了。

if you use .a , you should use it as follow img. 如果使用.a ,则应按照img使用它。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Objective-C框架的Swift Project - Swift Project using objective-c framework 将 Swift 框架导入到 Objective-C 项目中 - importing swift framework into a objective-c project 添加一个Swift框架的Objective-C项目,可以导入桥头,但是显示未声明的swift类 - Objective-C project adding a Swift framework, can import bridge header, but it show undeclared swift class 如何在Xcode Objective-C项目中的.mm类扩展中导入/使用快速静态库/框架 - How to import/use swift static library/framework in to .mm class extension in Xcode Objective-C Project 在Swift项目中使用CocoaPods作为模块添加Objective-C框架项目时,找不到iOS模块错误 - IOS Module not found error when adding Objective-C framework projects using CocoaPods as a module in Swift project 将cocoapods积分/安装到现有的xcode项目,objective-c或swift - Integarte/Install cocoapods to existing xcode project, objective-c or swift 在Objective-C项目中导入Pure Swift Framework - importing Pure Swift Framework in Objective-C Project 将 iOS 框架(Swift/Objective-C)导入到 Android 应用程序项目中? - Import an iOS framework (Swift/Objective-C) into an Android app project? 无法在框架项目的 Objective-C 代码中导入 Swift 类 - Unable to import Swift class in Objective-C code in a framework project 将单个Swift文件添加到现有的Objective-C项目 - Adding a single swift file to an existing objective-c project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM