Xcode ignores my frameworks - iphone

I get the following error for all the frameworks I use:
ignoring file /Developer/Platforms/iPhoneOS.platform/DeviceSupport/5.0 (9A334)/Symbols/System/Library/Frameworks/UIKit.framework/UIKit, file was built for unsupported file format which is not the architecture being linked (i386).
I am using these frameworks in other projects and they all work. Just this one is causing this issue. Project and target settings seem to be the same.
Any help?
Thanks

The error message states that you're including a framework for ARM (iOS) when compiling for i386 (Mac OS X).
That will not work.

Related

Framework issues in Xcode

I'm running the latest version of Xcode and am try to create an app for IPhone with IAd integrated into it and I have tried to integrate it many ways, but I keep receiving this error every time, ld: warning: ignoring file /Users/mini/Desktop/TheDateGetter/iAd.framework/iAd, file was built for unsupported file format which is not the architecture being linked (i386) I'm guessing this is a framework issue, because all of the code and everything else it correct. All help will be appreciated, thanks!
Check under Build Phases for your target which frameworks are you linking against. You will need to remove then the iAd framework from /Users/mini/Desktop/TheDateGetter and link the correct one from the iOS SDK.

linking static libraries in iOS5

I am new to iOS 5.
Currently working with xcode 4.2,Base sdk iOS 5.0,Apple LLVM compiler 3.0,architechture armv7.
Whenever I try to link a static library the following warning comes up.
ld: warning: ignoring file /Users/shilpasurendran/Desktop/InputVal_aslib/InputVal_aslib/iCodeBlogsMathLibrary/libICodeMathUtils.a, file was built for archive which is not the architecture being linked (i386)
I even tried changing deployment targets and compiler,but of no use.
Please help.
Thanks in advance!!
You are trying to build for armv7 architecture which means you want to build for a real device not the simulator.
The library you are linking to is in i386 architecture meaning it is compiled for the simulator.
When using a third-party library there often is a structure like this:
Library
build
Release-iphoneos
Release-iphonesimulator
Release-universal
If there is a universal build you should use that one. Try using the one under Release-iphoneos otherwise.
Hope that helps

How to add boost thread library to an iPhone project?

I am trying to port an existing project to iPhone which needs Boost.Thread library, the project compiles without error but there are link errors:
"boost::thread::start_thread()", referenced from:
boost::thread::thread<(anonymous namespace)::ReadThread::Function>((anonymous namespace)::ReadThread::Function, boost::disable_if<boost::is_convertible<(anonymous namespace)::ReadThread::Function&, boost::detail::thread_move_t<(anonymous namespace)::ReadThread::Function> >, boost::thread::dummy*>::type)in ChessEngine.o
How can I add the required thread libs to the Xcode project?
p.s. the boost lib is in: /usr/local/lib/libboost_thread-mt.a
EDIT (library found, but got architecture error):
Following Linking to Boost.Signals using Xcode, after adding /usr/local/lib in Library Search Path and -lboost_thread-mt in Other Linker Flags, the library is found. However, there are new errors and warnings:
ld: warning: in /usr/local/lib/libboost_thread-mt.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
How can I have the lib working for iOS (4.0 or later)? Thanks!
I did some more searching and found this downloadable script that will build a multi-architecture iphone ready version of boost. Also check out this blog post about using it.
It sounds like you are trying to link in a library for an architecture (armv6,7) when you probably have the current target set as a device (i386 - the simulator). If thats correct I'd say you have downloaded the library built for the device. To run in the simulator you need the version of the library built for your computer (I386).
The easiest way to handle any external library is for the developer of it to produce a armv6/armv7/i386 static framework. Then it's a piece of cake to use. If it's as much trouble as this sounds like, I'd be looking elsewhere for the functionality :-)

Linker error (only simulator) with own library after update to iPhone SDK 4.0

I recently updated to iPhone SDK 4.0 and are no longer able to build my project for the iPhone simulator. The problem is that classes of one of my own libraries can no longer be found by ld:
"_OBJC_CLASS_$_Book", referenced from:
objc-class-ref-to-Book in Category.o
(maybe you meant: ...)
ld: symbol(s) not found
collect2: ld returned 1 exit status
I already read some other posts about similar problems, like e.g. here. "Unfortunately", my problem has nothing to do with a SDK framework, but with my own lib, so the solutions mentioned there are not applicable here.
The library is included under "Link Binary With Libraries" of my target, library search paths are correct (checked this with XCode and with a plain text editor directly in my project file) and correctly added to the gcc command.
I'm using iPhone Simulator 3.2 as Base SDK, but the same problem occurs with SDK 4.0. Again, this works with my device target but not with my simulator target. It worked with both, though, before I updated from iPhone SDK 3.2 to 4.0. I was also able to reproduce this error by creating a new project with only one file and the linked lib. However, the lib should be okay as it worked with simulator 3.2 before I updated XCode and my SDK.
More Facts: Mac OS X 10.6.3, XCode 3.2.3 64-Bit, iPhone OS 3.2, GCC 4.2
Any help would be highly appreciated.
EDIT:
After reinstalling SDK 3.2, everything worked as expected again. It must be noted, that the SDKs in folder /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs are overwritten with each installation. I then tried to reinstall SDK 4.0 again and the same error as above occurred. I didn't change anything in my project and always used 3.2 as Base SDK.
The problem can therefore possibly be narrowed down to the following options:
Apple changed sth. in the Simulator SDK 3.2 that causes the problem
a change in XCode 3.2.3 causes the problem
wrong/missing compiler flags while building my own library (those flags, however, would only cause problems with a changed SDK or the changed IDE)
I also did a folder diff on /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk for both the old and the new version of this folder. It turned out that there are actually minor changes within the "same" SDK. I still think it's an IDE/compiler flag problem, though.
Anybody any ideas? I don't want to stick to 3.2 forever...
Make sure that you recompile your libraries with the same base SDK as you're using for your app.
I was finally able to figure out which flags were missing in my compiler call to build my lib. So, to answer my question: If anybody has problems linking his/her own static lib to a target in XCode 3.2.3 (using iPhoneSimulator3.2.sdk or iPhoneSimulator4.0.sdk), you need to build your lib with the following two flags:
-fobjc-abi-version=2
-fobjc-legacy-dispatch
Thanks again to PhoneyDeveloper for his hints.
Another thought- this has happened to me in the past even when libraries weren't involved.
Double check that you haven't imported files using the 'group folder references' option. It seems that this gives Xcode a headache. (At least it did in my case.)
i got solved this when i removed flags like (-ObjC, -all_load) under 'Other Linker Flags' which I was using in the project.there was -all_load conflict actually.

iphone warning libsqlite3.dylib is not of required architecture?

I'm writing an iPhone app which seems to run fine on the simulator, however when I try and run it on the device I get a libsqlite3.dylib, file is not of the required architecture error. I'm using os 3.0 on a 3GS. Any ideas on what could be causing this?
Thanks!
When you added the SQLite library to your project, it sounds like you chose the one from the iPhoneSimulator sdk. You need to choose the one in the iPhoneOS sdk for whichever version you're building for.
If you still get the error make sure you haven't accidentally copied the simulator version of the lib into your own project directory. You need to delete it if you have. This would have occurred because you accidentally selected 'Copy items into destination groups folder' when you added the lib to your project. Also make sure reference type is 'Relative to Current SDK'.
I had a similar issue which caused by the search paths for the linked library pointing to incompatible files.
I wrote a blog post on how to fix it here:
Fixing the "missing required architecture arm in file" error when developing for iPad