Last active
June 12, 2016 04:33
-
-
Save yourtion/9349476b151ffa035200af37cbeb1a3a to your computer and use it in GitHub Desktop.
Is http enable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)needTransportSecurity { | |
#if TARGET_OS_IPHONE | |
if([[[UIDevice currentDevice] systemVersion] compare:@"9.0" options:NSNumericSearch] != NSOrderedAscending){ | |
return YES; | |
} | |
#elif TARGET_OS_MAC | |
NSDictionary *systemVersionDictionary = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"]; | |
if([[systemVersionDictionary objectForKey:@"ProductVersion"] compare:@"10.11" options:NSNumericSearch] != NSOrderedAscending){ | |
return YES; | |
} | |
#endif | |
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