Re: URLWithString fails to fails with bad string
Re: URLWithString fails to fails with bad string
- Subject: Re: URLWithString fails to fails with bad string
- From: Mike Abdullah <email@hidden>
- Date: Wed, 25 Nov 2009 17:40:31 +0000
You should be able to weed stuff out pretty quickly by:
1) Use +URLWithString: to see if the string can be interpreted as a URL
2) Construct a request with the URL and see what +[NSURLConnection canHandleRequest:] has to say
3) Try to load the URL
On 25 Nov 2009, at 17:28, email@hidden wrote:
> On Nov 25, 2009 11:05am, Jens Alfke <email@hidden> wrote:
>
>
>> On Nov 25, 2009, at 8:59 AM, email@hidden wrote:
>
>
>
>> > Thanks for the reply. I'm looking through the Cocoa API now. I think I might be able to use NSNetService's -resolveWithTimeout along with NSURL's -scheme to validate a string. Seems like more work than should be necessary, but oh well.
>
>
>
>> Wait, what? That NSNetService method is for getting the IP address of a Bonjour service. That doesn't sound like what you're doing. It has nothing to do with validating the syntax of a URL.
>
>
>
>> Maybe you could describe what it is that you're trying to do with these URLs?
>
>
>
>> —Jens
>
> I was just looking through the API to see what methods might help me with this and NSNetService looked like it might work, until I read the class description. What I'm doing exactly, is downloading batches of web pages via http. I don't want to make the attempt if the url is not valid.
> _______________________________________________
>
> 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
_______________________________________________
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