Iphone Linker Error – “class.o for architecture i386" confused? - iphone

I am getting error Linker Error – class.o for architecture i386 on xcode project while i try to build the project. on my project i have used some third party framworks as well. any solution for this ??

To break down this issue here are some tips.
1>Make sure to included the QuartzCore framework or other required frameworks in your project. It should be in the Build Phases->Link Binary With Libraries.
3>Check while switching to the new version, you put the new library in a folder next to the old one, in case you had to switch back at some point. Normally when you removed the old version, it did not remove the path to the old version of the .a file from Library Search Paths in the build settings in "Project Name -> Under Targets" and delete the old path and add new one if required.
2>To add new class please select Project Name -> Under Targets select your target project name -> Build Phases -> Expand Compile Sources -> Click + at bottom of Compile sources and add the correct source file.
4>If the above tips are not working for you then be careful while adding files , don’t copy files directly, just create class by clicking on "new files" in Xcode and copy code one by one and add required frameworks. it won't show linker error .

I believe the class is not in your compile sources list.
Select your project on the navigation sidebar -> goto "build phases" -> expand "compile sources" -> add the corrensponding .m file for your class

Please check the class for which you are getting error message is linked to the target you are building.
Also make sure the third party library you are linking into project is properly linked and also linked at runtime of the project.
That is sure that application is able to find the class which you have mentioned at runtime.

Related

Kobold 2dD - kkARCSupport.h file not found - how to manage that?

I want to use audio management from Kobold2D (ObjectAL)in my general (existing) Xcode (single view) project.
I use instructions from official:
Copy libs/ObjectAL from this project into your project. You can simply
drag it into the "Groups & Files" section in xcode if you like (be
sure to select "Copy items into destination group's folder").
Alternatively, you can build ObjectAL as a static library (as it's
configured to do in the ObjectAL demo project).
Add the following frameworks to your project: OpenAL.framework
AudioToolbox.framework AVFoundation.framework
But got this error: kkARCSupport.h file not found. Why?

Getting XCode to include, compile and link existing (C++) codebase in XCode 4.3(.1)

I'm trying to 'import' my existing C++ codebase into my XCode iOS project.
Problem is, xCode won't compile (and therefore not link) my code.
This is what I've done so far:
File > Add files to "Project". I don't tick 'Copy files' since it's a shared codebase for multiple platforms and multiple copies of source code is not an option.
I've added appropriate path to the "Header Search Path" project settings. Including header files works, I can #include "stuff.h" from my Objective-C++ (.mm) file.
However, I can't find any way of actually telling XCode to compile the .cpp files?
A few points:
I'm not looking for a way to pre compile it into a library and linking that way
The project is a standard iOS Objective-C project. The C++ code is called from it (that's not a problem)
Update
I've added the codebase directory to the target's "Compile Sources". I actually have to click "Add other..." in the dialog that pops up, since I can't select the directory reference to my codebase.
When I add it, XCode asks me if I want to "Create external build system project". I leave it ticked and the two fields with the default values "/usr/bin/make" and "$(ACTION)". However, my codebase doesn't get compiled during the build. Do I have to write my own Makefile ?
If I don't select "Create external build system project" then a directory reference is created under the target, but not compiled during the build and a warning is emitted:
warning: no rule to process file '$(PROJECT_DIR)/../codebase'
of type folder for architecture i386
Even if you don't check Copy Files you have to check Add to Targets when adding the files to the project.
If you forgot to do that, you can select the target, go to the Build Phases tab and add the files to Compile Sources.
If you go to your Targets -> Build Phases -> Compile Sources -> "+" -> "Add Others" -> (select your external source folder) -> Select: Create Group for any added folders -> Unchecked: Copy items into destination.
Now your folder will be in XCode, mimic the structure. If you add source files to that folder in XCode the source files will be added to your external source directory just fine. So the ease of using multiple IDEs and having to manage source linkage is solved.
The catch. You still have to manually add files into the "Compile Sources" area. This is rather simple. Just click and drag your source files from the group directory in XCode right into the Compile Sources window. So there is an extra step when you add a source file now. Forgetting to add them to the Compile Sources window will yield unresolved symbols compile errors.

Sending email in an iPhone application

I am getting this warning
MessageUI.framework/MessageUI, file was built for unsupported file format which is not the architecture being linked (i386)
What does it say ?
I have added the Message Framework by drag and dropping to my resources folder (I also selected the tick where it says copy the files or something). Is this the correct way to add a framework ? I tired R-clicking the resource folder, but I couldn't find any menu option that says add framework or anything similar. (I am using xcode 4.2)
you should add the framework through target setting, under build phases, under link binary with libraries, add messageUI.framework there, DO NOT drag and drop and COPY into the resource folder.
You have to manually add MessageUI framework in your project.
To do that follow this step:
1) Click on your main project --> Go to Target ---> Select Build Phases --> Select Link Binary With Libraries.
2) Click on + sign and add framework named MessageUI.framework.

How to integrate RestKit Framework (restkit.org) with xCode 4?

I followed the instructions on the github page but something is wrong (most certainly is me: P) but, Do you know about any good tutorial for integrate / use in Xcode4 RestKit?
Thanks!
Download the latest version from this Link http://restkit.org/
and extract the zip folder and you will find a ReadMe.md file which explains you steps to install for Xcode 4.x as shown below
Xcode 4.x (Git Submodule)
Add the submodule: git submodule add git://github.com/RestKit/RestKit.git RestKit
Open the project you wish to add RestKit to in Xcode.
Focus your project and select the "View" menu > "Navigators" > "Project" to bring the project file list into view.
Drag the RestKit.xcodeproj file from the Finder and drop it on your "".xcodeproj.
Click on your project's name in the sidebar on the left to open the project settings view in the right pane of the window.
In the middle pane you will see PROJECT and TARGETS headers for your project. Click on your project name, then select Build Settings along the top to open the Build Settings editor for your entire project.
Find the Header Search Paths setting. Double click and add a new entry. Add a search path to the "$(SOURCE_ROOT)/RestKit/Build" directory you have added to your project. DO NOT check the Recursive checkbox.
Find the Library Search Paths setting. Double click and add a new entry. Add a search path to the "$(SOURCE_ROOT)/RestKit/Build/$(BUILD_STYLE)-$(PLATFORM_NAME)" directory you have added to your project.
NOTE: This is only necessary if you are NOT using DerivedData.
Find the Other Linker Flags entry and double click it. Use the + button to add a new entry and enter -ObjC -all_load. Dismiss the editor with the Done button.
Locate the target you wish to add RestKit to in the TARGETS list in the middle of the editor pane. Select it to open the target settings editor in the right pane of the window.
Click the Build Phases tab along the top of the window to open the Build Phases editor.
Click the disclosure triangles next to the Target Dependencies and Link Binary with Libraries items.
In the Target Dependencies section, click the + button to open the Target selection sheet. Click on the RestKit aggregate target (it will have the bulls-eye icon) and click the Add button to create a dependency.
In the Link Binary with Libraries section, click the + button to open the Library selection sheet. Here we need to instruct the target to link against all the required RestKit libraries and several system libraries. Select each of the following items (one at a time or while holding down the Command key to select all of them at once) and then click the Add button:
libRestKitCoreData.a - Optional. Only necessary if you are using Core Data.
libRestKitJSONParserJSONKit.a
libRestKitNetwork.a
libRestKitObjectMapping.a
libRestKitSupport.a
CFNetwork.framework
CoreData.framework - Optional. Only necessary if you are using Core Data
MobileCoreServices.framework
SystemConfiguration.framework
libxml2.dylib - Optional. Only necessary if you are mapping from XML payloads and link libRestKitXMLParserLibxml.a into your app.
Verify that all of the libraries are showing up in the Link Binary with Libraries section before continuing.
Congratulations, you are now done adding RestKit into your Xcode 4 based project!
You now only need to add includes for the RestKit libraries at the appropriate places in your application. The relevant includes are:
#import <RestKit/RestKit.h>
// And if you are using Core Data...
#import <RestKit/CoreData/CoreData.h>
I found this tutorial very useful to make it work on xCode 4.0.
http://liebke.github.com/restkit-github-client-example/
I did my build following this steeps https://github.com/RestKit/RestKit/wiki/Installing-RestKit-in-Xcode-4.x and guoleii is right. But I needed to change the owner directory.
Have you seen this threads from RestKit's Google Group?
link 1
link 2
Try searching there. But for now, there seems to be A LOT of issues with RestKit and Xcode 4, there's even a YouTube video showing the problems (none showing a how-to).
did you build RestKit according to the wiki page "Installing RestKit in Xcode 4.x" on github.com/RestKit? i think there is a little mistake. here is my solution: 1. in "Build Phases" -> "Link Binary With Libraries", delete the RestKit.framework and add Security.frameWork 2. build again
then it works.
I just tried to install RestKit on a newly created Xcode 5 iOS 7.0 project. I tried downloading the project and following the steps above, but i was missing most of the content with in the RestKit/Vendor folder. After doing a bit of research i did the submodule tactic and that got me all of the information from those folders.
From the command prompt change directory into your project folder, for me it was
$ cd Documents/Projects/NewlyCreatedApp
From there you should run this command if you have no git repository
Note: you must download git to install this, if you have not already
$ git init
after that you must run these commands to download restkit into your project folder
$ git submodule add git://github.com/RestKit/RestKit.git
$ git submodule update --init --recursive
After that, you should go up to Nakkeeran's answer above and start from step 2, to set up the process. In step 7 you will be asked to add "$(SOURCE_ROOT)/RestKit/Build" to your header search paths, but upon closer inspection the RestKit framework no longer has the build folder so you should change that to "$(SOURCE_ROOT)/RestKit/Code" to fit the current version of Rest Kit
I hope this helps, and here is a link to the submodule information i posted.
RestKit Installation Submodule Method

linking gdata to an xcode 4 project

I'm having major issues linking gdata to a project after upgrading from xcode 3.2.5 to xcode 4. I would like to know if anyone is having similar issues, and what did they do to resolve them. i am using gdata version 1.11 which is the latest on their site. The project works flawlessly on 3.2.5, thanks.
I have created a workspace for my project, and then added the gdata.proj to it. So I do have all the files linked by reference. But project files which include #import "GDataYouTube.h" do not see the file. I get "No Such File or Directory"
Good News... resolved and tested, all working follow these steps...
Open your project in xcode 4 from 3.2
click File -> Save As Workspace
in project navigator on the left, collapse your Project if you see all the files
below your collapsed project, in the empty space right click or control click -> Add Files to...
select the project file you wish to link to, leave Copy items unchecked, click Add
Now you will see 2 collapsed projects in your Project navigator, expand both
Now what I didn't know I had to still do
Drag the files or folders you want from the second project to your main, make sure your Main project target is selected in the options, and I also have group selected then click Finish
You are good to go, you might have some warnings about your second project and its targeted SDK. Fix those by clicking the project name in the Project Navigator -> Build Settings -> Base SDK to 10.6, Deployment Target to 10.5