How to determine if an iOS device has a cellular radio station?

Is it possible, without including an exhaustive list of models in the code, to determine if the iOS device contains cellular radio communications?

I am working on adding host availability check for the application and I would like the error message to be appropriate for the device. For instance:

Network connection is not available. Please join a Wi-Fi network or go to a place with the best cellular reception.

This is great for iPhone and iPad 3G, but it is a fan for iPod touch or iPad without 3G. For these devices, I would like to remove the mention of the cellular service.

I don’t want to create an array in the code of every iOS device that Apple sent with cellular radio.

+3
source share
2 answers

There seems to be no way. Erica Sadun has an interesting UIDevice-hardware extension project on github, but he cannot determine if there is cellular radio.

+1
source

The best you can do is use a project provided by Apple to achieve reachability.

http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html

It has three network status states:

typedef enum {
    NotReachable = 0,
    ReachableViaWiFi,
    ReachableViaWWAN
} NetworkStatus;

If the status returns ReachableViaWiFi, do not mention the cellular service.

This will be an improvement, because even with a cellular radio station you can only use wifi.

+1
source

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


All Articles