Skip to content

Instantly share code, notes, and snippets.

@derryl
Created October 10, 2013 01:12
Show Gist options
  • Save derryl/6911438 to your computer and use it in GitHub Desktop.
Save derryl/6911438 to your computer and use it in GitHub Desktop.
// User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43
userAgent = [
NSString stringWithFormat:@"%@/%@ (%@; iOS %@; Scale/%0.2f)"
, [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleExecutableKey] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleIdentifierKey]
, (__bridge id)CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle()
, kCFBundleVersionKey) ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleVersionKey]
, [[UIDevice currentDevice] model]
, [[UIDevice currentDevice] systemVersion]
, ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] ? [[UIScreen mainScreen] scale] : 1.0f)
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment