which framework contain dns_open function in iOS - iphone

dns_open is found in iPhoneOS5.0 in usr/include dns.h but I get a linker error. I can't seem to find the right framework for it.
on MacOSX this is probably found in System.framework but there is apparently no System.framework in iOS SDK

I'm pretty sure it's in libresolv.dylib. Try adding that from the list of "frameworks" you get when you add one in Xcode.

Related

IOS Static Library Product is always red

I've been struggling with this for a few days now. When I create a new Static Library project under IOS in XCode 4 I am running into an issue. With or without adding files as headers or to be compiled I am able to successfully build but the .a file is always red. This happens in both Debug and Release. I've read about similar issues but haven't found someone who has fixed the problem. Any help would be appreciated. Thanks
XCode seems to have a bug in this regard when building for the simulator. Build once for device, right-click the library to show in finder, back up a level, and navigate to the simulator one. Your library will be there. (The path will look something like this: /Users/You/Library/Developer/Xcode/DerivedData/LibName-fylbqugtzucxyndtdddrjmbbdnet/Build/Products/Debug-iphonesimulator)
I wasn't able to figure out the answer to this problem but I did find a work around. I installed the XCode 4 project template to build universal frameworks from https://github.com/kstenerud/iOS-Universal-Framework. This allowed me to build a framework which fit my needs.

iPhone framework paths?

I recently moved my projects to a new mac, along with a newer version of Xcode.
When i opened my project i noticed that some files were red. So i remapped them by setting the path (by project path) and then providing the proper path location.
Now my problem is that the frameworks that i have are red, and i cant find their location! I did set the framework paths to be "relative to current SDK" however.
Can anybody help me get my frameworks mapped correctly?
The frameworks im using are:
- QuartzCore.framework
- libsqlite3.0.dylib
- UIKit.framework
- Foundation.frameowrk
- CoreGraphics.framework
The XCode version is 3.1.4 (the only one installed).
The iPhone app was originally created using a prior version of Xcode (i dont remember which version).
I still dont have an answer. Im going deeper into this mess of a problem that Apple created.
In all my .m files im importing
How can i add this UIKit framework to my project Target with respect to the current SDK?
In fact, forget about the ref w/ respect to the SDK, let's just get the framework from the 3.0 SDK as a referenced framework. Right now when i reference it is red.
Note: references related to frameworks, everything about it, is driving me insane, and making me more frustrated at apple for this sloppiness, more than ever.
Any help is greatly appreciated.
I had exactly this problem. Somehow 'Base SDK' in Build Settings of a project was set to Mac OS X after I have installed Xcode 4.2.
Click on your project, change Base SDK to 'Latest iOS' and enjoy the vibe.
If you double click on your target to bring up the info pane you will see a tab labeled "Linked Libraries". From here you can click the plus button to add the libraries and xcode will do the right thing when you add the desired frameworks
I was having the same issue with red frameworks and bad pathing. If you're getting an error that says, "Base SDK Missing" you'll need to Get Info on your Xcode Project and check that it can find the right SDK.
Near the bottom of the General Info tab there will be an option Base SDK for All Configurations. Select a different SDK and see if that helps.
I ran into issues when I upgraded to a beta SDK and it was loading up deprecated frameworks from an old SDK.

non lazy ptr linking error - the solution

I have received many errors while trying to Build & Run my iphone app using the xcode.
All the errors stated "non lazy ptr" for the used variables in the code.
The solution for me (and for all of you) is to look for the correct framework to be used according to the Simulator and Device versions the code will be running on.
At first i have chosen the AVFoundation framework from the iphone os 2.2 folder. and when i removed that and choose the framework from the iphone os 3.0 folder - the linking errors where gone and the code run perfectly.
so, in short the solution is to change the framework source folder.
Hope that helps :)
Frameworks should automatically be taken from the Active SDK, so resetting them shouldn't be necessary. We've seen some projects that have somehow gotten hardcoded SDK paths into their Framework Search Paths build settings; that is often the cause of this problem (and your fix simply hardcodes a more-recent path for an invalid one, which kicks the can down the road a ways but will break again in the next SDK bump.) The real solution is to look at your target's Framework Search Paths and delete any SDK-specific paths you find.

Adding SDK-specific frameworks to Xcode

Xcode 3.2 kind of broke the build process of my iPhone app. I need to add a new framework to my project (MediaPlayer.framework).
So I go into my Target settings and try to add it to the "Linked Libraris" by hitting the [+] button. In the list the MediaPlayer.framework is missing, as well as other frameworks, such as UIKit, CoreGraphic and others. Some frameworks are still there.
I can add the frameworks by adding the SDK-specific ones (going into /Developer/Platforms/iPhoneOs.platform/...yadayadayada../frameworkd/) but then of course I can only compile for the iPhone platform and not for the simulator any more.
So basically I wonder how I can get Xcode back to chose the appropriate framework, depending on platform and SDK version for me?
Thanks and kind regards, Hans Schneider
Edit: Things I tried: Setting the Base SDK to 3.0 (was still 2.2.1), reinstalling 3.0 iPhone and Simulator SDK from the "packages" directory of the Xcode 3.2 DMG. Didn't help. The frameworks still wont show up in the list...
Edit 2: Ok, I now have the frameworks back in the list, I was previously in my AdHoc configuration. In Debug I have the frameworks back. But it still wont compile for the Simualtor (lots of Symbols(s) not found errors).
Looks like the linker doesn't choose the correct libraries and always uses the iPhoneOs3.0 path for the frameworks.
Goto 'Framework Search Path' in build section in target's property.
Add path:
$(SDKROOT)/Library/System/Frameworks
Then it should work well.
And once you press 'OK', you should be able to see the path is set to '/Library..."

Categories in static library for iPhone device 3.0

I have categories in my static library. Any application developer should set -ObjC flag to "Other Linker Flags" to use my static library properly. It works fine for iPhone device/iPhone Simulator 2.x and iPhone Simulator 3.0. But it crashes for iPhone device 3.0. As written in this article it is new linker bug. They suggest to use one more linker flag: -all_load. But when I add this flag, build fails too, because there are duplicate symbols.
How to use categories in static libraries for iPhone device 3.0? Any suggestions?
We ran into the same problem (under 3.0, -ObjC no longer links in categories) within the Core Plot framework. All I can say is that for us, we were able to add the -all_load option to the Other Linker Flags within the target application and that did away with the runtime errors. We didn't see any warnings for duplicate symbols.
I've filed a bug report for the linker behavior, as I'm sure others have.
Its a bug caused by trying to fix another bug with a hack.
The -all_load fix for the category bug is a total hack.
See here for more.
When you add -all_load to your other linker flags, make sure, all frameworks, the library uses are linked with your target app. Otherwise, it will fail to compile. In my case, I had a Category for MKMapView and did not bind the MapKit Framework with my target app, thus the class which the category belongs to wasn't found at build time.
I ran into the same "duplicate symbols" problem. Without the -all_load flag, we had to also include all libraries our library linked against in the app link line. Removing these from the app link line solved the issue.