Undefined symbols for architecture i386 when adding FaceBook Connect - iphone

I have the following failed code when i run my application on iPhone 5.1 simulator. My app runs smoothly before i add in the Facebook Connect into my application.
Undefined symbols for architecture i386:
"_FBCreateNonRetainingArray", referenced from:
-[FBSession initWithKey:secret:getSessionProxy:] in FBSession.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
May I know what can i do to get rid of this?
Thanks

2 things that usually get rid of that error.
1) go to: target > build phases > link binary with library -- make sure you've added the correct framework
2) go to: target > build phases > compile sources -- add any implementation files that are in your program but do not appear in that list.
Those two steps usually fix that kind of error.

Related

Xcode Build Failure on Archive, but not on Run with ResearchKit

I'm trying to build a project that has ResearchKit in it, and whenever I build and run on a physical device (or the simulator, for that matter) it works fine. But when I attempt to Archive it, I get the following error:
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_ORKVisualConsentStep", referenced from:
objc-class-ref in InformedConsent.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I followed the installation guidelines on the ResearchKit GitHub, and made sure to check that researchKit.framework was under the Frameworks, Libraries and Embedded Content section as well as the "Link Binary With Libraries" section of the build phases tab (as was described in this link as well as a couple others: Xcode build failure "Undefined symbols for architecture x86_64") but still nothing.
Is there something I'm doing wrong, or another setting I might be able to change?
UPDATE:
I noticed that the element that was throwing the error - ORKVisualConsentStep - was deprecated a few iOS versions ago. So by taking that out, I was able to get the project to archive.
I didn't want to put this as the accepted answer, though, because I wanted to see if there was a better solution than just deleting code.
Thanks for your help!

ignoring file [path] missing required architecture i386 in file

I'm quite new to Xcode and Iphone development and ran into the following problem:
I opened a new project and added *.h and a *.a files (which I recived from a certain device vendor).
I get the following warning:
ld: warning: ignoring file /Users/udi/Desktop/Xcode/Xcode Projects/Scosche/libmyTrekSDK_armv7.a, missing required architecture i386 in file /Users/udi/Desktop/Xcode/Xcode Projects/Scosche/libmyTrekSDK_armv7.a (2 slices)
If I ignore the warning, and try to instanciate the class that is given to me in the header file, I get these errors:
ld: warning: ignoring file [Path/FileName.a], missing required architecture i386 in file [Path/FileName.a] (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_HRMonitor", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
I've checked the Framework Search Pathes (as mantioned in many other posts) and it clear.
More info:
I'm Using Xcode 4.6.1
The files are currently located at project's root folder.
I'm using a Single View Application tamplate.
Appreciate any help
This warning means that you're trying to use library made for Device (ARM) with your Simulator (i386).
You can use this terminal command to create a universal library:
lipo -create lib_arm.a lib_i386.a -output lib_universal.a
More info about lipo command here.
Change your target's "Build Settings > Build Active Architectures Only" to "No"
This is doing the same thing as Dmitry Zhukov's answer but doing it thru Xcode instead of going around its back.
If you are working with a 3rd party code, keep in mind that some SDKs may not work on the simulator. The same build error I have encountered vanished, when I ran the project on the device.

Ar metio build error

When I'm trying to run the project i receive the following errors
Here is the log.
Undefined symbols for architecture armv7: __ZN6metaio40getScreenRotationForInterfaceOrientationE22UIInterfaceOrientation", referenced from: -[MetaioSDKViewController viewDidLoad] in MetaioSDKViewController.o -[MetaioSDKViewController willAnimateRotationToInterfaceOrientation:duration:] in MetaioSDKViewController.o -[ARELViewController willAnimateRotationToInterfaceOrientation:duration:] in ARELViewController.o ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Does any one knows what the reason might be.
This project has bind with the Metio . AR framework.
Thanks
Click on your Project and go to Build Settings and change the value of Build Active Architecture only to yes.
Let me know if it solves the error:)

Linker command failed with exit code 1 - not sure why

I'm not sure exactly why i'm getting this. It usually comes because of a missing framework, except its mentioning a class I already have in my project, and imported into the file it's saying the error is on. It says...
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_ELCImagePickerController", referenced from:
objc-class-ref in JCreateViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
JCreateViewController.m had this in the imports:
#import "ELCImagePickerController.h"
So i don't really know why it's giving me this error.
Any ideas?
In the interest of providing an acceptable answer, from the comments:
Make sure ELCImagePickerController is included in your project's Compile Sources build phase.
you can add resources to your projects build phases by simple select and add see this link

Simple Torch Application in XCode

I am trying to build a simple torch application for iOS 5 as described in http://developer.apple.com/library/mac/releasenotes/AudioVideo/RN-AVFoundation/_index.html#//apple_ref/doc/uid/TP40010717-CH1-DontLinkElementID_17 but i am getting "Apple Match-O Linker Error:
Undefined symbols for architecture armv7:
"_AVMediaTypeVideo", referenced from:
-[FirstViewController viewDidLoad] in FirstViewController.o
"_OBJC_CLASS_$_AVCaptureDevice", referenced from:
objc-class-ref in FirstViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any help appreciated
Anybody ?
Additionally: it only happens when running the project, no errors if i just clean & Build, and the code completion detects the library.
Thanks
You might need to link your project with the AVFoundation framework first.
If you're already doing that, make sure you're building for armv7 and not just armv6.
Check it in your project settings > Target > Build Settings > Architecture
As simple as this:
Linker errors like this indicate that a symbol is missing when the app is being linked. Most system symbols like these, come from system frameworks. So, I was missing a framework in my project that contains AVCaptureDevice and AVMediaTypeVideo.
To solve it, i just added the AVFoundation framework following this tutorial: http://www.thinketg.com/Company/Blogs/11-03-20/Xcode_4_Tips_Adding_frameworks_to_your_project.aspx
Now it runs !