3

Following Swift3, I'm getting an error on UnsafePointer. The debugger's proposed solution is not really clear enough to do something with though.

I know UnsafePointer has been raised in a previous question Issue with UnsafePointer in 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.

Code:

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

Does anyone know how to fix it?

Community
  • 1
  • 1
Shane O'Seasnain
  • 3,534
  • 5
  • 24
  • 31
  • Did you read the Xcode 8 release notes? This is thoroughly explained IIRC. – matt Sep 18 '16 at 09:29
  • Thanks guys. Searching based on the error did not throw up these answers. As for the documentation, I regularly check Apple docs but usually get generic descriptions and methods that link to other methods, without providing examples of how to use them. It could be more accessible. – Shane O'Seasnain Sep 18 '16 at 10:18

0 Answers0