I use reachability to check internet connection when I connect to wifi it works fine. But when its connected to LTE network it gives me No Connection error, even though it is connected, I can browse the internet perfectly with LTE. I have also enabled App Transport Security
in info.plist. I'm testing it on ios 10.1.1, do I have to do something to get internet access for my app in ios 10 using LTE?
Asked
Active
Viewed 494 times
0

Tejas Ardeshna
- 4,343
- 2
- 20
- 39

Jack Sparrow
- 113
- 1
- 3
- 13
-
did you check this http://stackoverflow.com/questions/9561253/checking-cellular-network-type-in-ios – guru Dec 23 '16 at 05:23
1 Answers
1
Guru provided an excellent link in his comment. An updated way to check an LTE connection is indeed through CoreTelephony. Seeing as you asked in Swift though, I'll provide a Swift answer.
Make sure you have CoreTelephony.framework added under your project's Build Phases > Link Binary With Libraries
The code to check the connection in Swift would be as follows
import CoreTelephony // Make sure to import CoreTelephony
let constantValue = 8 // Don't change this
func checkConnection() {
let telephonyInfo = CTTelephonyNetworkInfo()
let currentConnection = telephonyInfo.currentRadioAccessTechnology
// Just a print statement to output the current connection information
print("\(constantValue)==D, Current Connection: \(currentConnection)")
if (currentConnection == CTRadioAccessTechnologyLTE) { // Connected to LTE
} else if(currentConnection == CTRadioAccessTechnologyEdge) { // Connected to EDGE
} else if(currentConnection == CTRadioAccessTechnologyWCDMA){ // Connected to 3G
}
}

Justin Lennox
- 147
- 15