• 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: Create a NSURL as a way to validate urls - not working
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Create a NSURL as a way to validate urls - not working


  • Subject: Re: Create a NSURL as a way to validate urls - not working
  • From: Mike Abdullah <email@hidden>
  • Date: Mon, 02 Mar 2015 23:46:56 +0100

> On 2 Mar 2015, at 23:22, Juanjo Conti <email@hidden> wrote:
>
> According the docs (
> https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/)
> NSURL(string: aString) will return nil if aString is malformed.
>
> But I've tried this in the a playground and no nil is returned:
>
> NSURL(string: "")!
> NSURL(string: "ssss")!
>
> Why is this? are the docs wrong?

Go read the specs NSURL references. An empty string and “ssss” are both valid by its definition.

Pretty much all NSURL is looking for is you’re not using any unsupported characters, or mis-using reserved characters. Anything more, and you’ve got to test the resulting URL yourself. Perhaps you can elaborate what you consider to be a valid URL in your case.


_______________________________________________

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


  • Follow-Ups:
    • Re: Create a NSURL as a way to validate urls - not working
      • From: Juanjo Conti <email@hidden>
References: 
 >Create a NSURL as a way to validate urls - not working (From: Juanjo Conti <email@hidden>)

  • Prev by Date: Re: NSTextField highlight
  • Next by Date: Re: Responsive scrolling control with lots of subviews
  • Previous by thread: Create a NSURL as a way to validate urls - not working
  • Next by thread: Re: Create a NSURL as a way to validate urls - not working
  • Index(es):
    • Date
    • Thread