• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Setting the NSURLDownload user agent
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting the NSURLDownload user agent


  • Subject: Re: Setting the NSURLDownload user agent
  • From: "Quinn \"The Eskimo!\"" <email@hidden>
  • Date: Tue, 21 Apr 2015 09:42:27 +0100

On 20 Apr 2015, at 19:37, Nick Beadman <email@hidden> wrote:

> Does any one have any idea how I would write code to get the CFNetwork and Darwin versions?

@import Foundation;

static NSString * CFNetworkVersion(void) {
    return [NSBundle bundleWithIdentifier:@"com.apple.CFNetwork"].infoDictionary[@"CFBundleShortVersionString"];
}

#include <sys/utsname.h>

static NSString * DarwinVersion(void) {
    struct utsname u;
    (void) uname(&u);
    return [NSString stringWithUTF8String:u.release];
}

However, I'm with Jens here: if you're going to set a customised user name, just use the OS name and version.  The only reason to be sending this goo is if you're server varies its behaviour base on the user agent string, which is a bad idea in general and pretty rare for a download server (as opposed to a server that's vending web pages, where it happens all the time).

Share and Enjoy
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Setting the NSURLDownload user agent
      • From: Nick Beadman <email@hidden>
References: 
 >Setting the NSURLDownload user agent (From: Nick Beadman <email@hidden>)
 >Re: Setting the NSURLDownload user agent (From: "Quinn \"The Eskimo!\"" <email@hidden>)
 >Re: Setting the NSURLDownload user agent (From: Nick Beadman <email@hidden>)

  • Prev by Date: Re: Questions on when credentials are used in NSURLSessionDownloadTask
  • Next by Date: Re: Questions on when credentials are used in NSURLSessionDownloadTask
  • Previous by thread: Re: Setting the NSURLDownload user agent
  • Next by thread: Re: Setting the NSURLDownload user agent
  • Index(es):
    • Date
    • Thread