Bridge Swift到Objective-C库“ono”使用cocoapods [英] Bridge Swift to Objective-C library "ono" using cocoapods

查看:328
本文介绍了Bridge Swift到Objective-C库“ono”使用cocoapods的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的swift iPhone应用程序,我需要解析XML。

For my swift iPhone app I'm needing to parse XML.

我正在使用 Alamofire 并尝试使用 Ono 这是一个客观的c库。我用cocoapods来安装Alamofire& Ono。

I'm using Alamofire and trying to use Ono which is an objective c library. I used cocoapods to install Alamofire & Ono.

我已按照此处的步骤操作:如何将Cocoapods与Swift项目集成?

I've followed the steps here: How to integrate Cocoapods with a Swift project?

我有 #import<我的桥接标题中的Ono / Ono.h>

很奇怪,在swift中我可以引用许多Ono类,但是有一个函数 XMLDocumentWithData 我不能。例如。 HTMLDocumentWithString 我可以调用,但 XMLDocumentWithData 我不能。

Whats very odd is that in swift I can reference many of the Ono classes, but there is one function XMLDocumentWithData that I can't. E.g. HTMLDocumentWithString I can call, but XMLDocumentWithData I can't.

推荐答案

正如mattt在他的评论中指出的那样,代码生成不知何故已哄骗货物。

As mattt points out in his comment, somehow the code generation has "slurped" up the goods.

以下是您现在可以调用该方法的方法:

Below is how you can call the method instead for now:

let XML = ONOXMLDocument(data: data, error: &XMLSerializationError)
//let XML = ONOXMLDocument.XMLDocumentWithData(data, error: &XMLSerializationError)

这篇关于Bridge Swift到Objective-C库“ono”使用cocoapods的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆