I have been developing an app to programmatically enable/disable Wi-Fi interface of my iphone. I have tried to use the Apple 80211( apple's private service) on my jail broken Iphone 4s (iOS 5.1.1) to make it work. However, thing does not work out as I expected.
I can successfully scan and get the status of Wi-Fi connection however, the method Apple80211SetPower
to enable/disable WiFi seems does not work on iOS 5.
As I found out from SBsetting's WiFi toggle, It might also require to change the system property of WiFi at "/var/preferences/systemconfiguration/com.apple.wifi.plist"
. However, my app is failed to change system property in that file, I suspected the problem resulted from file property and ownership. Therefore, I imitated the file property of SBsetting's WiFi toggle, Still, it did not change a thing.
does anyone know how I could change the system property of this file? this is the code that I used. thanks and regards
NSMutableDictionary *plistDict =
[NSMutableDictionary dictionaryWithContentsOfFile:@"/var/preferences/SystemConfiguration/com.apple.wifi.plist"];
BOOL wifiState = [[plistDict objectForKey:@"AllowEnable"] boolValue];
NSLog(wifiState ? @"Yes" : @"No");
if (value == YES)
{
[plistDict setValue:[NSNumber numberWithBool:YES] forKey:@"AllowEnable"];
[plistDict writeToFile:@"/var/preferences/SystemConfiguration/com.apple.wifi.plist"
atomically: YES];
}
else if (value== NO)
{
[plistDict setValue:[NSNumber numberWithBool:NO] forKey:@"AllowEnable"];
[plistDict writeToFile:@"/var/preferences/SystemConfiguration/com.apple.wifi.plist"
atomically: YES];
}