Difference between gethostname() and [NSProcessInfo hostName]?

857 views Asked by At

So, I have an iPhone app that freezes at startup with one particular iPhone on a mobile carrier.

I traced this down to a [NSProcessInfo hostName] call which blocks for around 45 seconds before returning what I think is a correct result. I don't really see a particular reason for why it should block, but it definitely appears to be making a network call for each call.

I tried replacing this though with something which appears to do the exact same thing, but without taking any amount of time, gethostname().

In the end, they both return the exact same thing in all cases I could come up with. What exactly is the difference and why is [NSProcessInfo hostName] so slow?

0

There are 0 answers