'init' is not available: use 'withMemoryRebound (to: capacity: _)'

After Swift3, I get an error UnsafePointer. The proposed debugger solution is actually not clear enough to do anything.

I know what UnsafePointerwas raised in the previous question The problem with UnsafePointer in a SQLite project in Swift , but I'm struggling to relate its answers to this problem.

Error:

'init' is unavailable: use 'withMemoryRebound(to:capacity:_)' to temporarily view memory as another layout-compatible type.

the code:

let defaultRouteReachability = withUnsafePointer(to: &zeroAddress) {
            SCNetworkReachabilityCreateWithAddress(nil, UnsafePointer($0))
        }

Does anyone know how to fix this?

+4
source share

Source: https://habr.com/ru/post/1654966/


All Articles