• 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: Uli Kusterer <email@hidden>
  • Date: Tue, 03 Mar 2015 01:43:29 +0100

I think you want NSURLComponents.

> On 03 Mar 2015, at 00:55, Juanjo Conti <email@hidden> wrote:
>
> Ok, I wanted to validate that the url is an absolute one. Is there
> something in Swift standard lib to do this?
>
> Thanks in advance!
>
> On Mon, Mar 2, 2015 at 7:46 PM, Mike Abdullah <email@hidden> wrote:
>
>>
>>> 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.
>>
>>
>
>
> --
>
> Juanjo Conti <jjconti <http://goog_2023646312>@carouselapps.com
> <email@hidden>>
>
> Software Engineer - Carousel Apps <https://carouselapps.com>
>
> --
> Carousel Apps Limited, registered in England & Wales with registered number
> 7689440 and registered office Unit 2 Artbrand Studios, 7 Leathermarket
> Street, London SE1 3HN. Any communication sent by or on behalf of Carousel
> App Ltd or any of its subsidiary, holding or affiliated companies or
> entities (together "Watu") is confidential and may be privileged or
> otherwise protected. If you receive it in error please inform us and then
> delete it from your system. You should not copy it or disclose its contents
> to anyone. Messages sent to and from Watu may be monitored to ensure
> compliance with our internal policies and to protect our business. Emails
> are not secure and cannot be guaranteed to be error free. Anyone who
> communicates with us by email is taken to accept these risks.
> _______________________________________________
>
> 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

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


_______________________________________________

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


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

  • Prev by Date: Re: Inconvenient exception impossible to get rid of?
  • Next by Date: Re: Inconvenient exception impossible to get rid of?
  • Previous by thread: Re: 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