Xcode 4.3.3 missing SenTestingKet.framework causes Undefined symbols "_OBJC_METACLASS_$_SenTestCase" - osx-lion

On my MAC mini osx-snow-leopard xcode4.1 my project can run SenTestingKit.framework tests. Got a MACBook Pro with osx-lion 10.7.4 with xcode4.3. For the same project I cannot run unit tests because SenTestingKit.framework is not to be found. I copy sentestingkit from the Mac mini to "/Applications/Xcode.app/Contents/Developer/Library/Frameworks". Add to each target Framework Search Paths:
$(inherited)
"$(DEVELOPER_LIBRARY_DIR)/Frameworks"
This resolves to "/Applications/Xcode.app/Contents/Developer/Library/Frameworks".
I can add sentestingkit to the project so it compiles. I can't run Product > Test because of this link error undefined-symbol:
Undefined symbols for architecture i386:
"_OBJC_METACLASS_$_SenTestCase", referenced from:
_OBJC_METACLASS_$_Field_MobileApplicationTests in Field_MobileApplicationTests.o
"_OBJC_CLASS_$_SenTestCase", referenced from:
_OBJC_CLASS_$_Field_MobileApplicationTests in Field_MobileApplicationTests.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

I had the same problem by using my class that want to be tested. I got this error:
Undefined symbols for architecture i386:
"_OBJC_METACLASS_$_JsonDictParser", referenced from:
_OBJC_METACLASS_$_MainData in MainData.o
_OBJC_METACLASS_$_JsonObjectClass in JsonObjectClass.o
"_OBJC_CLASS_$_JsonDictParser", referenced from:
_OBJC_CLASS_$_MainData in MainData.o
_OBJC_CLASS_$_JsonObjectClass in JsonObjectClass.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have created an object from my class that I want to test and forgot to tell the „Target Membership“. So I make sure I checked the test class.
E.g. I want to use JsonDictParser class for testing in my JsonTestLogicTest class. So I focus the JsonDictParser.m file, clicked the File Inspector at the right side on the main window, selected Target Membership and checked my class where my testcases are in JsonTestLogicTest.
Or open the .xcodeproject file in the Project Navigator, select the target with the test methods > Build Phases > Compile Sources and add the .m file which includes your classs that you want to test.

Related

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:)

Reachability error in integration of admob

I am trying to integrate admob in my ios application but I am getting following errors when I add sdk and build it.
Undefined symbols for architecture i386:
"_SCNetworkReachabilityCreateWithName", referenced from:
-[GADNetworkChecker startNetworkChecking] in libGoogleAdMobAds.a(GADNetworkChecker.o)
"_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
-[GADNetworkChecker startNetworkChecking] in libGoogleAdMobAds.a(GADNetworkChecker.o)
"_SCNetworkReachabilitySetCallback", referenced from:
-[GADNetworkChecker startNetworkChecking] in libGoogleAdMobAds.a(GADNetworkChecker.o)
"_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
-[GADNetworkChecker stopNetworkChecking] in libGoogleAdMobAds.a(GADNetworkChecker.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have included all required framework including SystemConfiguration, CFNetwork etc.
Update
I am getting this error when I build in simulator but not when I build with device. is it sdk issue? I am using simulator 5.1.
Make sure that the frameworks that you added are correctly linked under the "Link Binary With Libraries" section of your Build Settings. Also, look at "Compile Sources" under "Build Phases" to make sure all of the relevant files you want to compile are there.

Xcode 4.3.1 import files to new project

I accidentaly remove target in my previews project and i decided to create new one and import files. I added all frameworks and copy my AppDelegate files. When i build project i have this error.
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_AppDelegate", referenced from:
objc-class-ref in main.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Please help..
Check in your target's build phases that the AppDelegate.m is in the Compile Sources and the AppDelegate.h is in the Copy Headers Section
Make sure all .m files (specifically AppDelegate) are included in the target membership. (check box under file inspector when class is selected)

MapKit not working on device but works in simulator

I have added the frameworks (MapKit and CoreLocation) by selecting the Frameworks folder, right clicking, Add > Existing Frameworks.
The app builds in the Simulator (3.1.3) but fails on the Device (3.1.3) with the error:
ld: warning: in
/Development/Sites/iPhone
Projects/SwitchViews/MapKit.framework/MapKit,
file is not of required architecture
Undefined symbols:
"_OBJC_CLASS_$_MKPinAnnotationView",
referenced from:
__objc_classrefs__DATA#0 in NextView.o ld: symbol(s) not found
collect2: ld returned 1 exit status
It seems that I just needed to restart Xcode to get things linked up properly.
It looks like you by accident have selected the "copy to project" checkbox when adding the framework.
Try to delete the framework from your project and add it again, making sure you have selected the default framework path, and that you don't copy it to your project.