简体   繁体   English

Swocoa项目中的Cocoa pods目标c文件。 桥接问题

[英]Cocoa pods objective c files in Swift project. Bridging issue

I downloaded code from here: 我从这里下载了代码:

https://github.com/QuickBlox/quickblox-ios-sdk https://github.com/QuickBlox/quickblox-ios-sdk

wich include sample-chat-swift example folder where seems somehow guys created a framework. 包括sample-chat-swift示例文件夹,似乎某些人创建了一个框架。

In my case if I just use cocoa pods to pull code into my project Xcode says to me that we can't find any of downloaded classes. 在我的情况下,如果我只是使用可可豆荚将代码拉入我的项目Xcode告诉我,我们找不到任何下载的类。 So I am sure that is problem with bridging but my question what are the steps I need to do to create framework like guys did in theirs example. 所以我确信这是桥接的问题,但我的问题是我需要做什么步骤来创建像他们这样的人做的框架。

Or do I need to bridge each files manually? 或者我是否需要手动桥接每个文件? If so I guess it can take so much time. 如果是这样,我想它可能需要很长时间。

I created my own framework for using Tumblr in an app. 我创建了自己的框架,在应用程序中使用Tumblr。 I'm sure you know how to setup a framework project, but I'll explain what I did when I complied the framework. 我确定你知道如何设置框架项目,但我会解释我在编译框架时所做的事情。 After you finished the framework what you do is under your xcode project folder in the directory is a fold Products . 完成框架后,您所做的是在您的xcode项目文件夹下的目录中是折叠Products The text for Project.framework should be red or black. Project.framework的文本应为红色或黑色。 Either way run your project and make sure its black. 无论哪种方式运行您的项目并确保其黑色。 Then right click and choose Show in Finder . 然后右键单击并选择Show in Finder Then you can copy that framework and bring it into the top of the project you want to use the framework in. 然后,您可以复制该框架并将其置于要使用框架的项目的顶部。

在此输入图像描述

You will also need to make a header file. 您还需要创建一个头文件。 Like the one I have below if you are using Obj-c, but I'm sure you can google and find an example in swift it you are trying to hide certain aspects of your framework with a swift interface file. 就像你下面使用Obj-c一样,但我确信你可以google并在swift中找到一个例子,你试图用swift接口文件隐藏框架的某些方面。

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>

//! Project version number for Tumblr.
FOUNDATION_EXPORT double TumblrVersionNumber;

//! Project version string for Tumblr.
FOUNDATION_EXPORT const unsigned char TumblrVersionString[];

// In this header, you should import all the public headers of your framework using statements
//#import <Tumblr/Tumblr.h>


#import "TMSDKUserAgent.h"
#import "JXHTTPDataBody.h"
#import "JXHTTPOperationQueueDelegate.h"
#import "TMTumblrAuthenticator.h"
...

Regarding bridging issue, guys form QB answered on it: 关于桥接问题,QB的回答是:

so using this http://quickblox.com/developers/IOS-how-to-connect-Quickblox-framework#Additional_steps_for_Swift_using_CocoaPods 所以使用这个http://quickblox.com/developers/IOS-how-to-connect-Quickblox-framework#Additional_steps_for_Swift_using_CocoaPods

we can simple achieve bridging, even without creating framework. 即使没有创建框架,我们也可以简单地实现桥接。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM