tags:

views:

187

answers:

1

I have tried to fetch /etc/resolv.conf by open("/etc/resolv.conf", 0644)

but it return -1 and the errno is 2 which means "no such file"

what can I do?

+1  A: 

You can't access files outside your Application's sandbox.

Jasarien
We have a winner! Apple is lying to you! The file exists but you don't have access! What is worse than no error message? A dishonest error message!
PP
@PP Sure, Apples engineers have explicitly added this "wrong" error code for this particular device OS.
bddckr
There's no indication that the message is dishonest or even wrong. It might just be omitting some salient information. "There is no such file" is what the error says, but the non-truncated message could actually be "There is no such file available to you".
Jasarien
are there any solution to get dns server ip on iphone app?
Gary