Re: [iPhone] get iPhone's IP address...
Re: [iPhone] get iPhone's IP address...
- Subject: Re: [iPhone] get iPhone's IP address...
- From: KK <email@hidden>
- Date: Mon, 20 Jul 2009 15:36:43 +0900
Does the iPhone have NSURLConnection? If so, you can just point that to
www.whatismyip.com or a similar site, and just parse the information.
On Mon, Jul 20, 2009 at 3:11 PM, Clark Cox <email@hidden> wrote:
> On Sun, Jul 19, 2009 at 10:50 PM, James Lin<email@hidden> wrote:
> > Hi all,
> >
> > I found this code snipet that's supposed to return the iPhone's IP
> address.
> >
> > I am wondering if anyone can confirm the method for me.
> > As i am told that this method works in an actual iPhone and not on the
> > simulator.
> > But i won't have an iPhone until Aug 9th....
> >
> > All i am getting in the simulator is something like :
> > "fe80::21e:52ff:fec6:b7401.618407e-303n1"
> >
> > I am wondering if anyone can confirm the method works (ie, returns an
> actual
> > ip address) on an actual iPhone for me....
>
> IPv6 addresses *are* actual addresses. The real question is what you
> need this IP address for. Macs (and iPhones) have many IP addresses,
> so asking for the machine's one address is the wrong question to ask.
>
> > The code:
> >
>
> Also, using NSHost in this manner can hang your code for a long time
> as you wait for responses from DNS servers. Please make sure that you
> do not ever use NSHost from the main thread of your application.
>
>
> --
> Clark S. Cox III
> 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
>
_______________________________________________
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