Reachability.swift icon indicating copy to clipboard operation
Reachability.swift copied to clipboard

Under what conditions can init fail?

Open pepasflo opened this issue 7 years ago • 1 comments

I noticed that the initializers on Reachability are failable, but I'm having a hard time figuring out under what circumstances this can actually happen. i.e. will this only happen if some call to malloc fails deep inside of SCNetworkReachabilityCreateWithAddress? I need to understand the risks of doing something like Reachability()!.

If you have any insight here, could you add a comment to init which describes the conditions under which it can fail?

Thanks!

pepasflo avatar Nov 01 '17 21:11 pepasflo

Did you ever get any answers on this?

I get a crash in the convenience init? at guard let ref = SCNetworkReachabilityCreateWithAddress(nil, &zeroAddress) else { return nil }

zackshapiro avatar Oct 25 '18 14:10 zackshapiro