Undefined symbols for architecture i386: Facebook Audience Network (help needed!) - facebook

I've read close to 50 threads on here, regarding linking frameworks to an Xcode project, but I've yet to find one that covers an issue I'm having with Facebook's Audience Network framework.
I'm using Xcode 4.2.3 (I'm on an old mac with OS X Lion - don't ask!), building for iOS 6.1, using Facebook SDK 3.2.1.
I'm trying to test banner ad formats within specific view controllers, however, getting an error every time I build the code, based exactly on the tutorials, even Facebook's sample code isn't compiling. I've added FBAudienceNetwork.framework to almost every folder on my machine, added via dragging and dropping, and via the Link Binary with Libraries option. I've tried to changing the Framework Search paths, to no avail.
I'm using the following frameworks: AdSupport, StoreKit, CoreMotion, UIKit, Foundation, CoreGraphics
Getting the following error:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CAShapeLayer", referenced from:
objc-class-ref in FBAudienceNetwork(FBAdChoicesView.o)
"_OBJC_CLASS_$_CATransaction", referenced from:
objc-class-ref in FBAudienceNetwork(FBAdUtility.o)
objc-class-ref in FBAudienceNetwork(FBAdMediumRectangleView.o)
"_OBJC_CLASS_$_NSURLSession", referenced from:
objc-class-ref in FBAudienceNetwork(FBAdUtility.o)
"_kCATransactionDisableActions", referenced from:
-[FBAdMediumRectangleView updateViewForSize:view:] in FBAudienceNetwork(FBAdMediumRectangleView.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any suggestions?
UPDATE: Added in Quartzcore.framework, and errors now reduced to;
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_NSURLSession", referenced from:
objc-class-ref in FBAudienceNetwork(FBAdUtility.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 made Foundation.framework optional. Build settings armv7, armv7s, iOS 6.1, Simulator only. Build Active Architecture ONLY Yes/No.

I'm a software engineer on the Audience Network team at Facebook, and I have some suggestions that may help.
Try adding "QuartzCore.framework" to your target. That should resolve the _OBJC_CLASS_$_CA* linker errors. Classes with a "CA" prefix are part of QuartzCore/Core Animation.
If the "_OBJC_CLASS_$_NSURLSession" error still appears, try weak-linking the Foundation framework by setting the "Foundation.framework" to "optional" in Build Phases, Link Binary With Libraries.
You should be able to successfully build after those steps. Hope that helps!

NSURLSession was added in iOS 7.0. Any improper reference to it in your app will cause this problem when ran on a device with iOS 6.0. You need to use proper techniques to ensure the class is never referenced under iOS 6.0 or make your deployment target iOS 7.0.

Related

error on AdMob integration

I Have added Addmob sdk in my project and even added all framework needed. But m getting below error for StoreKit framework even i have added it in my project but still getting error..
ld: warning: directory not found for option '- L/Users/company/Downloads/projectname/GoogleAdMobAdsSdkiOS-6.4.2/Add- ons/GoogleAnalyticsiOS_2.0beta4/Library'
ld: warning: directory not found for option '-L/Users/company/Downloads/projectname/GoogleAdMobAdsSdkiOS-6.4.2'
ld: warning: ignoring file /Users/company/Downloads/StoreKit.framework/StoreKit, missing required architecture i386 in file /Users/company/Downloads/StoreKit.framework/StoreKit (2 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_SKStoreProductViewController", referenced from:
objc-class-ref in libGoogleAdMobAds.a(GADOpener.o)
"_SKStoreProductParameterITunesItemIdentifier", referenced from:
-[GADOpener openInAppStore:fallbackURLString:] in libGoogleAdMobAds.a(GADOpener.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I search a lot but in every post its sid to add Storkit.. but i have already added it but still getting error. even i have cleaned the project a lot of time.
Just ensure that you have added the following libraries,
1.AudioToolbox
2.MessageUI
3.SystemConfiguration
4.CoreGraphics
Also the frameworks,
1.MessageUI.framework
2.StoreKit.framework
3.SystemConfiguration.framework
According to your error message there is a problem with StoreKit.framework...Please verify that...
Refer: build error when add Admob in iOS app
Add AdSupport.framework, also make it as optional
It says that your StoreKit binary is not build for i386. This should not happen with the default one. Did you download if separately from somewhere? You can find the default here:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer‌​/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/StoreKit.framework
Use that.

iPhone - How to add AdSupport.framework in ios?

I am trying to use the AdMob in my test application when I rum my application i am getting the following error as shown below.
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_ASIdentifierManager", referenced from:
objc-class-ref in libGoogleAdMobAds.a(GADIdentifierUtilities.o)
"_OBJC_CLASS_$_SKStoreProductViewController", referenced from:
objc-class-ref in libGoogleAdMobAds.a(GADOpener.o)
"_SKStoreProductParameterITunesItemIdentifier", referenced from:
-[GADOpener openInAppStore:fallbackURLString:] in libGoogleAdMobAds.a(GADOpener.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I googled around this errors and everyone telling to add the AdSupport.framework. But when I try to add that framework in my Xcode4.1 and Xcode4.4 there is no AdSupport.framework is not missing. Where can I get it and how to add that framework.
AdSupport.framework available only in iOS6+, so you won't be able to find it in XCode version prior to 4.5
UPD:
According to AdMob 6.2.0 changelog:
Required to use Xcode 4.5 and build against iOS 6. The minimum deployment is iOS 4.3.

How can I install EGOPhotoViewer in my app?

I am trying to create a photo gallery in my app, I tried to use Three20 and EGOPhotoViewer. I would like to use EgoPhotoViewer but I am new at programming and I don't know how to install EgoPhotoViewer to my app. When I try to use it I got this error:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_MyPhoto", referenced from:
objc-class-ref in MasterViewController.o
"_OBJC_CLASS_$_MyPhotoSource", referenced from:
objc-class-ref in MasterViewController.o
"_OBJC_CLASS_$_EGOPhotoViewController", referenced from:
objc-class-ref in MasterViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Is there any way of doing this?
If EGOPhotoViewer is just a couple of classes (which is what it sounds like), then drag them into your project and #import and #class them in the proper files. If it's a framework, then drag it into your project and make sure that it is being linked in build settings, then #import <> the necessary header.
Your undefined symbols error just means that you're trying to reference an invisible, non-existent, or out of reach class.
EDIT: For future reference because I know you're still a beginner. When you see "Undefined symbols for architecture XXXX"; the XXXX is the MOST important part. If it says armv6 or armv7, then you have a device build problem. If it says "i386", that's a simulator problem. I'm going to guess that the classes for EGOPhotoViewer are universal, but there are cases where the dunderheads decided not to build for the simulator (Dropbox anyone?) and undefined symbols for architecture i386 would come up.

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 !

Why does this debug build reference a release library?

I just installed Xcode 4 and am getting this error in my project:
ld: warning: directory not found for option '-LDebug-iphonesimulator4.3'
ld: warning: ignoring file /Developer/Projects/BuildOutput/Release-iphoneos/libMyFramework.a, missing required architecture i386 in file
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_MyRandomNumber", referenced from:
objc-class-ref in myAppDelegate.o
objc-class-ref in RootViewController.o
I have the project set to iOS 4.3 Simulator. I did check that scheme and it is set to debug build configuration. Why does it reference a Release version of the above library?
Also, what is the i386 error about?
I'm seeing this type of error as well. The odd part is that I've been building, linking, and running successfully under the Simulator. I just now tried to fire my app up in my iPhone, and am totally bombing out during the link process.
I've run my app on my iPhone before. I've been building it under Xcode 3.2.x for the last year, and have never seen this problem.
A couple of other SO threads indicate that it could be due to copying a framework into the project folder, and that one should just "move the framework." Okay. Where, and how do I let Xcode know where it is? And if that's not the problem, then what is?
Xcode 4 has a ton of promise, but it is a sore pain in the ass sometimes....