Iphone slowly recognizes Wi-Fi hotspot change

I have an application that needs to be connected to a specific access point. This access point is not connected to the Internet. when I change the network to โ€œsettingsโ€ for this new AP, I see that I got the IP address in a few seconds, but it takes 60-70 seconds to display the Wi-Fi symbol in the status bar. when I return to my application, I canโ€™t connect to the AP until this symbol appears. as soon as it appears, the connection works fine, but 60 seconds is a long time to wait for the user. I am using NSStreamManager to switch with AP.

I donโ€™t understand why I canโ€™t connect as soon as the settings display the IP address. I know that the apple does not allow you to control the network settings in the application. Any suggestions would be appreciated.

Additional Information:

To understand the problem, I added a timer loop that starts as soon as I open the application after switching to a new wifi network. it reports reachability status (via apple reachability class) and tries to get the SSID. if these two methods are successful, then it sends a JSON message to the AP using streamManager if it does not call itself again in one second. The plug is available and the SSID is read in the very first cycle (less than 1 second), but the stream manager still needs a balance of 60 seconds. I do not believe that the problem is related to the AP, since the Android version for Android does not cause connection problems.

-(BOOL)didConnect{ NSString *ssidString=[self.serverCommManager fetchSSIDInfo]; NSString *ssidStart=[ssidString substringToIndex:5]; NSLog(@"****:didConnect ssidStart=%@ ",ssidStart); if([ssidStart isEqualToString:@"Ppppp"]){ NSLog(@"****:didConnect isEqual=TRUE"); self.streamManager = [[NSStreamManager alloc] initWithDelegate:self]; [self.streamManager connectToHost:PlugHostName onPort:PlugPort withMessage: [JSONQuery queryIsPlug]]; [self removeWaitView]; return YES; }else{ NSLog(@"****:PlugSetupTVC didConnect isEqual=FALSE"); [self startTimingWithInterval:1]; return NO; } } 
+4
source share
1 answer

Since iOS (iOS7.0 below) will automatically try to ping (kinda) the random address of the apple to find out if your device is connected to the Internet, so why do the phenomena you described happen.

In iOS 7.0 above, there is a new feature that allows you to stop the automatic procedure for sending addresses.

There is a solution, because iOS is trying to get the html file of the result, then it will show the Wi-Fi symbol, so I managed to change the DNS setting and make the html file containing the result, the same as what it wants to get .... But I donโ€™t think this will help with your problem because you are writing an application, so you cannot control the DNS if you can.

0
source

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


All Articles