Re: Correct way to specify anchors with NSURL?
Re: Correct way to specify anchors with NSURL?
- Subject: Re: Correct way to specify anchors with NSURL?
- From: Graham Cox <email@hidden>
- Date: Thu, 21 Apr 2016 17:09:41 +1000
> On 21 Apr 2016, at 3:22 PM, Quincey Morris <email@hidden> wrote:
>
> On Apr 20, 2016, at 22:16 , Graham Cox <email@hidden> wrote:
>>
>> But it’s 10.9+ only. I really need a solution that will work back to 10.7 (or 10.8 at the latest).
>
> Then I’d guess you’d need to construct the entire URL as a string first, then use initWithString. Presumably ‘URLByAppendingPathComponent’ %-encodes a # because you’ve told it that your substring is a *path* component. If you give it a whole string, I’d assume it figures out that it’s got a “fragment” at the end.
>
> But I’m just guessing now.
>
Yah, that works. Thanks.
It strikes me that it’s a bug that URLByAppendingPathComponent: doesn’t parse for a fragment just as -initWithString: does though, the anchor/fragment is a perfectly reasonable part of a path and what other possible ambiguious meaning could it have? It makes hard work of something that should be easy.
—Graham
_______________________________________________
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