2

I need to link against libresolv library , and use it to find my dns ip.

Any advice on how to do that ?

Edit:

And how to find dns ip Using this library ?

Idan
  • 5,717
  • 10
  • 47
  • 84

1 Answers1

6

In Xcode3, on the left you should have a folder called "System Frameworks" or something like that were there are already other frameworks like Foundation.framework and UIKit.framework. Right-click on that folder, select "Add > Existing frameworks..." and select "libresolv.dylib" from the list.

Edit: I finally found out how to do this in Xcode4... on the left, in the navigator, select the left-most icon (Project, Command-1). In the tree below, click on the top-most item which is your project. Next, you need to select your target in the left column of the center view. Select the "Build Phases" tab. You now see a bunch of items that can be expanded. Expand the "Link Binary With Libraries" build phase, on the lower-left of that box is a "+" button ("Add items"). Click that, then select "libresolv.dylib" from the list. Phew. A lot harder to find than in Xcode3, IMHO.

Edit 2: If all you want to do is resolve the IP address of a hostname then you don't need to link libresolv (AFAIK). See 3 Ways to Resolve a Hostname in iOS for solutions and see the question How to perform DNS query on iOS.

Community
  • 1
  • 1
DarkDust
  • 90,870
  • 19
  • 190
  • 224
  • See my question here, I want to get the DNS not just the IP from Host.http://stackoverflow.com/questions/5325401/getting-dns-server-ip-on-iphone/5325453#5325453 – Idan Mar 16 '11 at 13:11