Home>

When the terminal is not connected to the network, a dialog likePhoto 1is displayed.

What you know

[iOS] Detecting network connection status

Isn't FBNetworkReachability better than Reachability?

As you can see from theURLabove,ReachabilityandFBNetworkReachabilitycan be used.

What you do n’t understand

The aboveURLis old and I don't know how to embed it in the application and write the code in the current development environment.
(I want to check the network status when starting the app)

Photo 1

Environment

xcode: ver11.0
swift: ver5.1
iOS: 13.1.1
(UserInterfaceisStroyboardinstead ofSwiftUI)

  • Answer # 1

    If you look into it, the following page will be helpful.
    http://en.voidcc.com/question/p-sapbbhby-ew.html

    But it may be deprecated by Apple.
    Because it's also the "misunderstanding of Reachability" on the following page,
    There are times when you try to connect and use the result.
    It seems that you should not expect a connection.

    https://qiita.com/shiz/items/a9e1cf91381a72fad807

    You should get the result of reachability and display it with alert.

  • Answer # 2

    I will close it once.