Re: -[NSURL path] returning empty string for relative file URL
Re: -[NSURL path] returning empty string for relative file URL
- Subject: Re: -[NSURL path] returning empty string for relative file URL
- From: Glen Simmons <email@hidden>
- Date: Fri, 11 Nov 2005 11:23:29 -0600
On Nov 11, 2005, at 9:34 AM, Niko Matsakis wrote:
Well, I'm not creating the NSURL in this case, the NSTextView is.
I'm shoving some XHTML into the NSTextView and it's interpreting
anchors as clickable links. When clicked, my
textView:clickedOnLink:atIndex: method gets called with the NSURL
in question. The original XHTML had this:
<a href="foo.bar"><span>Link to foo.bar</span></a>
But if I shove it into the NSTextView like that, the NSURL I get
back looks like this:
applewebdata://108AB768-64CD-41CF-94FA-C4558EBA0B1E/foo.bar
which is a bit difficult to deal with.
Ah, I see. Sorry, missed the full context of the original
message. Just went and fished it out of the archives. I suspect
that in your initial call to
initWithData:options:documentAttributes:error: on the
NSAttributedString, you want to provide the following entry in your
options: dictionary. If you look in the documentation, you'll see
an entry called NSBaseURLDocumentOption; I believe if you set that
to the URL of the XHTML file, you should be all set. You can
construct the URL using one of the NSURL convenience methods.
Yep, this is the answer. Seems kind of obvious now, oh well.
Thanks!
Glen
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden