解决方案4.我发现了如何取消引用它:
var error: NSError = errorPtr.memory!
Jernej Stras.. 5
我建议你阅读使用Swift with Cocoa和Objective-C指南的指针部分:https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithCAPIs.html#//apple_ref/DOC/UID/TP40014216-CH8-XID_16
指针部分底部有一个表,它解释了类指针如何桥接到Swift指针类型.基于此,NSError指针应该是AutoreleasingUnsafePointer
.搜索NSErrorPointer的标题会产生以下结果:
typealias NSErrorPointer = AutoreleasingUnsafePointer
为什么额外的?
后NSError
?我想这是因为NSError也可以nil
.
希望能帮助到你!
解决方案4.我发现了如何取消引用它:
var error: NSError = errorPtr.memory!
我建议你阅读使用Swift with Cocoa和Objective-C指南的指针部分:https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithCAPIs.html#//apple_ref/DOC/UID/TP40014216-CH8-XID_16
指针部分底部有一个表,它解释了类指针如何桥接到Swift指针类型.基于此,NSError指针应该是AutoreleasingUnsafePointer<NSError>
.搜索NSErrorPointer的标题会产生以下结果:
typealias NSErrorPointer = AutoreleasingUnsafePointer<NSError?>
为什么额外的?
后NSError
?我想这是因为NSError也可以nil
.
希望能帮助到你!