在Swift3之后,我在UnsafePointer
收到错误。虽然调试器提出的解决方案并不是很清楚。
我知道UnsafePointer
已在上一个问题Issue with UnsafePointer in SQLite project in Swift中提出,但我很难将其答案与此问题联系起来。
错误:
'init' is unavailable: use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type.
代码:
let defaultRouteReachability = withUnsafePointer(to: &zeroAddress) {
SCNetworkReachabilityCreateWithAddress(nil, UnsafePointer($0))
}
有谁知道如何修复它?