Re: How to get remote metadata
Re: How to get remote metadata
- Subject: Re: How to get remote metadata
- From: Mike Abdullah <email@hidden>
- Date: Sun, 27 Sep 2015 18:31:07 +0100
> On 27 Sep 2015, at 18:08, Gerriet M. Denkmann <email@hidden> wrote:
>
> I want to get some metadata for a remote file.
> I tried:
>
> NSString *path = @"/Public/UNIDATA/Blocks.txt";
> NSURL *icuBlocksUrl = [ [ NSURL alloc ] initWithScheme: @"http" host: @"unicode.org" path: path ];
> NSArray *keys = @[ NSURLContentModificationDateKey, NSURLCreationDateKey, NSURLFileSizeKey ];
> NSError *outError;
> NSDictionary *icuDict = [ icuBlocksUrl resourceValuesForKeys: keys error: &outError ];
>
> Now icuDict is non-nil but empty.
>
> What am I doing wrong?
>
> Gerriet.
>
> P.S.
>
> Just seen in small print: “This method applies only to URLs that represent file system resources.”
>
> So this is not expected to work. What else can I do?
Probably the best thing to do is to use NSURLSession to send a HEAD request to the server, and pick the information you want out of the response headers.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden