Bridge Swift to Objective-C library “ono” using co

2019-05-29 05:41发布

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

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

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

where I have #import <Ono/Ono.h> in my bridging header.

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.

1条回答
Lonely孤独者°
2楼-- · 2019-05-29 06:15

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)
查看更多
登录 后发表回答