I am using an external framework and where ever I am using the classes of the framework, I am getting the following error:
".objc_class_name_<FrameWorkClassName>", referenced from:
I checked the header search path and library path and I am giving the correct relative path there.
One important thing is that I am able to run the code on Simulator but it is creating issue on device.
Any clue will really help?
If it works on the simulator, then I would guess that the framework you are linking against is built for the simultator and not the device. The simulator uses the i386 architecture, while the device uses the arm architecture. Make sure you have a copy of it with the arm architecture.
As far as I know this error implies that the compiler is not able to find the referenced framework. Try cleaning all targets and make sure every framework you are using is added properly to the project. Which framework are you trying to use?
Related
I want to create static library through Xcode 4.I took one .a build using cocoa Touch static library.When I add .h file and .a file into new project ,it gives missing required architecture i386 in file error.I have to set any
Header search path in xcode 4 like earlier versions.?
1)what is the best approach, can i develop static library which will work in simulator and device as well through xcode 4?
2)some tutorials are saying that we have to develop
a)Create a build for the device (the armv6 and armv7 architecture).
b)Create a build for the simulator (the i386 architecture).
cant we develop single .a component for all architecture?
which one is the right in above?what is the right approach?any help please?
A nice way to solve this is to use the workspace feature and include the library’s target in the main project. That way the library gets compiled more or less automatically with the correct settings and it’s much easier to propagate changes in the library code. Of course, this is only an option unless you want to distribute the library without sources to other people.
This is regarding use of Tesseract in an iPhone app. I followed the steps provided here:
http://iphone.olipion.com/cross-compilation/tesseract-ocr
Now I have 2 questions:
1) How to use this in my iPhone project (which files need to be included, methods need to be called, etc.)
2) I googled and found that I'll have to include libtesseract_api.a
but got this message:
file was built for unsupported file format which is not the architecture being linked (i386)
Please help me to understand this.
I guess you have tried to run the app in Simulator, which will support i386 architecture.
Please follow this link to make the static library.
Start here:
http://tinsuke.wordpress.com/2011/02/17/how-to-cross-compiling-libraries-for-ios-armv6armv7i386/
and then follow this updated guide:
http://tinsuke.wordpress.com/2011/11/01/how-to-compile-and-use-tesseract-3-01-on-ios-sdk-5/
It will help you cross compile and build a universal library that contains the arm6/arm7/i386 all in the one statically linked library so it should work on simulator and device and be suitable for AppStore distribution.
Also if you have XCode 4.3 or higher beware and read the comments about how the developer directory has changed.
I'm fairly new to the iOS SDK and Xcode and I stumbled across this XML-RPC framework https://github.com/eczarny/xmlrpc that I'd really like to use in one of my projects. I downloaded the sources, the initial target was set to Mac OS, so I changed that to iOS 4.3 but got the following dependency error:
target specifies product type 'com.apple.product-type.framework', but there's no such product type for the 'iphoneos' platform
So I removed all the targets and added a new one from scratch using the Cocoa Touch Static Library, and it seems like it's been built just fine. Now my question is whether this is the correct way to build that library for iOS development, and where do I take it from here? I can't find the .framework directory anywhere (the install dir was set to "#executable_path/../Frameworks") so I can't embed it in my iOS project. How exactly does this go? Thanks!
Thanks for your help and sorry if this is too "newbish". Cheers!
If you're using Xcode 4.x open the Organizer, select the Projects tab and then down the left hand side you should see an entry relating to the XML-RPC project. Select that and under the Derived Data heading you'll see a path which if you follow using finder should lead you to the folder containing the static library you've built.
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.
I have two projects, a Cocoa iPhone application and a static library which it uses.
I've tested it successfully on the iPhone simulator, but when I try to deploy it to my iPhone device I get (symbol not found) link errors.
If I remove the dependancy of the library the project builds/runs fine.
I have made sure all the build settings are set to iPhoneOS not the simulator.
Im sure its something simple, but has anyone run into similar problems moving from iPhone simulator to device?
--EDIT: I have managed to create new projects (one for the application and one for the static library), and successfully get them to run on the iPhone or simulator. But I have a very strange problem... for each specific project I cannot get it working for BOTH the device and the simulator... I have double checked the build settings, made sure the libraries that are being references are for the matching build settings (I believe) but I cannot resolve these linking errors.
I think I must be doing something very wrong... all the apple documentation says 'its super simple - one click' but this is giving me a lot of problems.
This is probably something to do with xCode build settings, but I cannot seem to understand why selecting the different build platforms and rebuilding the libraries does not work.
Check out my answer to a similar question for a link to an article that might help. There is a link to an interesting article.
Eventually I realised what the problem was.
I changed my device target from simulator to iPhone device, then removed the old (simulator) static library and attached the new (device) library.
All fine, except the library search path (in the build configurations) still had the simulator directory listed first, which I assume cause it to be found and used rather than the device.
This also explains why I was able to make each setting work with a new project, but only had trouble changing between settings.
Its a simple and stupid problem, but one that caused me some grief and time. Im still not sure how to properly set target dependent build settings but at least if anyone is getting similar problems its something to look out for.
I've created a complete tutorial on how to create and use static libraries, this tutorial covers the the method that is also advised by apple, maybe people will find it usefull:
http://www.sodeso.nl/?p=822
Advantages of this methods is that it automatically recompiles the library according to your project settings (so no trouble with device / simulator builds)