objective c - iOS: When does iPhone switch from wifi to mobile network? -


i developing ios app main function communicate devices in local wifi network. means wifi connection required internet connection not.

additionally app tries fetch data (like current software version, info critical update etc.) internet when app starts.

now have test scenario. wifi network without connection internet. iphone logged in wifi. when app starts behaviour unpredictable.

sometimes data fetching internet fails due fact wifi has no internet connection. in 20-30% data fetching internet works fine. in case can see wifi symbol disappears , lte symbol appears 2 or 3 seconds , wifi symbol appears again.

obviously iphone switches wifi mobile network fetch data , wifi , not. possible control behaviour?

here code fetching data internet:

nsurl *url = [nsurl urlwithstring:@"https://myurl.com/data.xml"]; nsdata *data = [[nsdata alloc] initwithcontentsofurl:url]; nserror *error = nil;  nsdictionary *dictionary = [xmlreader dictionaryforxmldata:data error:&error]; if(dictionary){     currentone = [[[dictionary valueforkey:@"versions"] valueforkey:@"myapp"] valueforkey:@"current"];     nextone = [[[dictionary valueforkey:@"versions"] valueforkey:@"myapp"] valueforkey:@"next"];      if(currentone && nextone){         //check app versions     } } else {     nslog(@"--------------------------------------");     nslog(@"versions dict empty - no internet connection");     nslog(@"--------------------------------------"); } 


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -