Re: NSURL and NSRegularExpression
Re: NSURL and NSRegularExpression
- Subject: Re: NSURL and NSRegularExpression
- From: Per Bull Holmen <email@hidden>
- Date: Sun, 04 Mar 2012 16:11:53 +0100
Den 04:27 4. mars 2012 skrev R <email@hidden> følgende:
> All good, valid and useful points.
>
> However, I would at least like to maintain the same functionality of
> the Twitter App for iPhone.
>
> The app does does a pretty good job of detecting and reviewing the URL
> to determine if it can be assumed to be 20 characters.
Let me ask a few stupid questions, because sometimes stupid questions
can be helpful:
1) You want to make an app that lets the user post messages on twitter, right?
2) When URLs are posted on twitter, they are automatically shortened
to some bit.ly or similar type of address, right? Or are you planning
to do the shortening yourself?
3) You want to determine in advance whether an URL will be shortened,
right? Perhaps to give better feedback to the user about how many
characters the user has left?
I say this is impossible to do perfectly, unless Twitter has some
special service for developers who struggle with this problem. Perhaps
they have some http-based interface to determine if an URL will be
shortened, I don't know. Perhaps they have a specification of how they
determine what URLs to shorten.
There has been some discussion about whether to do a DNS lookup. There
are good reasons to avoid it, but any solution will have its flaws
anyway. How about you start with a valid URL, then you introduce a
spelling error in the host name, and use the "host" command, or
"nslookup" from terminal to determine that the new host name really is
unregistered. Then you type in your full URL including typo into your
reference app, and see whether it is interpreted as a URL that can be
shortened. Then you'll know whether that app does use DNS lookups to
determine it.
Apart from that, since you haven't seen a satisfactory response on the
list yet, I think there is no Cocoa-specific solution. Therefore I
think you will get better help in a more general technical forum, such
as stackoverflow.
Per
_______________________________________________
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