Browse files

Tweak user agent generation to be smart about the version numbers used

  • Loading branch information...
1 parent 04bc671 commit be69495cc9ef29bf4743430b8351c890024dc28f @pokeb committed Sep 13, 2009
Showing with 15 additions and 3 deletions.
  1. +15 −3 Classes/ASIHTTPRequest.m
View
18 Classes/ASIHTTPRequest.m
@@ -2465,9 +2465,21 @@ + (NSString *)defaultUserAgentString
if (!appName) {
return nil;
}
- NSString *appVersion = [[bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"] stringByAppendingFormat:@" (%@)",
- [bundle objectForInfoDictionaryKey:@"CFBundleVersion"]];
- NSString *deviceName;;
+ NSString *appVersion = nil;
+ NSString *marketingVersionNumber = [bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
+ NSString *developmentVersionNumber = [bundle objectForInfoDictionaryKey:@"CFBundleVersion"];
+ if (marketingVersionNumber && developmentVersionNumber) {
+ if ([marketingVersionNumber isEqualToString:developmentVersionNumber]) {
+ appVersion = marketingVersionNumber;
+ } else {
+ appVersion = [NSString stringWithFormat:@"%@ rv:%@",marketingVersionNumber,developmentVersionNumber];
+ }
+ } else {
+ appVersion = (marketingVersionNumber ? marketingVersionNumber : developmentVersionNumber);
+ }
+
+
+ NSString *deviceName;
NSString *OSName;
NSString *OSVersion;

0 comments on commit be69495

Please sign in to comment.