We are developing an iPhone application for which i need to read iPhone Settings value (precisely the status of 'Settings->General->Date & Time->Set Automatically'). Is there any way easy/difficult way to find out that value? Any tips and tricks will be highly appreciated.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can use the following code (I just found this out by examining the contents of the /var/mobile/Library/Preferences/
directory on my iPad):
NSDictionary *pref = [[NSUserDefaults standardUserDefaults] persistentDomainForName:@"com.apple.timed"];
BOOL autotime = [[pref objectForKey:@"TMAutomaticTimeEnabled"] boolValue];
NSLog(@"Automatic time is %@", autotime ? @"enabled" : @"disabled");
These keys are undocumented and you should probably not use them in an AppStore app. You can, however, safely use them in in-house apps or softwares for jailbroken devices.
回答2:
Nope, sorry, this is not possible.