Skip to content

Instantly share code, notes, and snippets.

Last active Jun 12, 2016
What would you like to do?
Is http enable
- (BOOL)needTransportSecurity {
if([[[UIDevice currentDevice] systemVersion] compare:@"9.0" options:NSNumericSearch] != NSOrderedAscending){
return YES;
NSDictionary *systemVersionDictionary = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"];
if([[systemVersionDictionary objectForKey:@"ProductVersion"] compare:@"10.11" options:NSNumericSearch] != NSOrderedAscending){
return YES;
return NO;
- (BOOL)isHTTPEnable {
if([self needTransportSecurity]){
NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];
return [[[infoDict objectForKey:@"NSAppTransportSecurity"] objectForKey:@"NSAllowsArbitraryLoads"] boolValue];
return YES;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment