Undefined symbols in SenTestingKit - xcode

Just turned on unit testing on an existing project, follow all the instruction here, here will no luck.
Any hints? There are tests that work, but I was testing with a category class instead of a totally custom class.
I should also mentioned that I am using CocoPods which seems to compile fine in the test target. Oh, and I am using xcode 4.6
Here is the relevant error msg:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_UIHelpers", referenced from:
objc-class-ref in EventHashTest.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

What's happening here is that your implementation (.m) for UIHelper can't be found by the UnitTest. You need to make sure your UIHelper.m is part of your app or your unit test target. See how the UIHelper.m is indicated as having target membership by the text box in the ride pane:
And, the unit test target is able to find this implementation b/c this target depends on the app target. See in the middle pane where the app is listed as a target dependency:

Related

xcode 10.1 Undefined symbols for architecture arm64

I already gone so many SO threads with similar issue but none of them seems to resolve my error.
In our project we have multiple "TARGETS". Only one of the target - the very first target created ever - is archiving properly. When I try to archive other target we encounter this error
Undefined symbols for architecture arm64:
"_OBJC_CLASS_$_DynamicEventData", referenced from:
objc-class-ref in DataManager.o
objc-class-ref in DataReader.o
"_OBJC_CLASS_$_DynamicDataService", referenced from:
objc-class-ref in DataManager.o
"_OBJC_CLASS_$_DynamicDataConfig", referenced from:
objc-class-ref in DataManager.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I did compare the Build Setting of the working target to the other targets but all of them are equal. I checked the header files and they exists in our project directory. I tried to manually add the header files' path to Header Search Paths but same result still getting the error.
Any idea? I really need to resolve this to export an ipa file.
Thanks!
I scan manually check the Build Phases > Link Binary With Libraries of the working target vs the defected targets. I found a one framework/library that was only added to the working target the said framework isn't manage by pod that may explain why the other target doesn't have it. I think it was added manually in the project.
I add the said framework to all targets and now I can build without the said error.
Thanks!
I encountered the same problem and the solution I found is so simple (man....).
Search in the project for the classes that are mentioned in the error.
Go to the "File Inspector" and simply check V for the rest of the targets in the "Targets Membership".
That's it! It took me Two Hours (wasted time) to find out.
Hope my solution will save time for anyone with similar problem.

Unity project. Undefined symbols for architecture armv7

I make a build for iPhone for the first time and got a problem.
I already checked a lot of posts and didnt find answer.
When i make a build on device a get:
Undefined symbols for architecture armv7:
"RegisterAllStrippedInternalCalls()", referenced from:
RegisterAllInternalCalls() in libiPhone-lib.a(MonoICallRegistration.o)
"RegisterAllClasses()", referenced from:
InitializeEngineNoGraphics() in libiPhone-lib.a(SaveAndLoadHelper.o)
"RegisterMonoModules()", referenced from:
_main in main.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
On simulator ok.
libiPhone-lib.a added to link libraries.
Can somebody tell what it is? Please
Your unity version is not compatible, just download the latest version of unity which I believe is 4.3.1 and try recompiling. Here is the link if you need it. http://unity3d.com/unity/download/download-mac
The new version is compatible with armv7.
ok if anyone else is experiencing the same problem here's a way out:
those 3 methods mentioned are declared in the RegisterMonoModules.cpp in the Libraries folder, usually. so take that cpp file and add it to your target's Build Phases > Compile Sources
then if you have additional SDK's integrated that are not added to the 'Compile Sources' the new build will throw some other errors. just make sure to add the wrapper .mm files from the sdk's to your Compile Sources. Usually one .mm file per sdk. (e.g. for unity facebook sdk it's FbUnityInterface.mm file)
hope this helps

getting linker error even after linking the core data.framework to my project target file

I have linked the target file of my project to the coredata.framework in the Build Phases.
But still I am getting 3 linker errors like below:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CoreDataTableViewController", referenced from:
_OBJC_CLASS_$_RolesTableViewController in RolesTableViewController.o
"_OBJC_METACLASS_$_CoreDataTableViewController", referenced from:
_OBJC_METACLASS_$_RolesTableViewController in RolesTableViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am getting this problem in 2 coredata examples i was following from the tutorials. I tried to find if i missed a step. I think I am doing some small fundamental error...
Please help, what it could be...
I'm sure this is solved now, but I had the same problem. When you copy the files to your project you need to ensure you put a check next to your project under "Add to targets".

Is there a way to use GrowlApplicationBridge without NSClassFromString?

I'm trying to build a basic cocoa app that uses Growl.
Every time I want to use GrowlApplicationBridge I have to use something like
Class GAB = NSClassFromString(#"GrowlApplicationBridge");
[GAB performSelector:#selector(setGrowlDelegate:) withObject:self];
I would like to be able to just use
[GrowlApplicationBridge setGrowlDelegate:self];
Here's the compiler error that I get when I try the behavior that I want:
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_GrowlApplicationBridge", referenced from:
objc-class-ref in StatusMenuAppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
As long as you're importing <Growl/Growl.h> at the top of that file and linking the framework into your app, you should be able to use [GrowlApplicationBridge setGrowlDelegate:self] just fine.
Check the top of the file and make sure you're importing it, and check your target's “Link Libraries and Frameworks” build phase and make sure you're linking it.

Code doesn't compile in unit tests target (XCode)

I have a problem with my unit tests in XCode. I have an active target which directly depends on a UnitTests target. I have generated some code with ProtocolBuffers library and I have added these classes together with ProtocolBuffers project to my project. Everything compiles well in the active target, however in the UnitTests target I'm getting the following error:
Undefined symbols for architecture armv6:
"_OBJC_CLASS_$_CRequestMessage", referenced from:
objc-class-ref in CConnection.o
ld: symbol(s) not found for architecture armv6
collect2: ld returned 1 exit status
I had noticed that the generated m file is not added to the UnitTests target so I added this file to the target. Now I'm getting over a thousand errors, including:
(...) ../ProtoBuff/Classes/CodedInputStream.h:27: error: cannot find interface declaration for 'NSObject', superclass of 'PBCodedInputStream'
NSObject is not visible?
Of course before adding the generated code everything had worked and compiled well.
Any ideas how to deal with this?
Thanks!
Did you add "ProtocolBuffers.h" to your target?

Resources