Three20 linker error - iphone

I have the following line of code:
if( !self.isLoading && TTIsEmptyString !TTIsEmptyString(_username) )
and it results in the following error:
Undefined symbols:
"_TTIsEmptyString", referenced from:
-[UserModel load:more:] in UserModel.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
I've read, that linker errors come from 'not included' libraries, but the three20 lib is included in my project.
Any ideas?

I believe the latest version of Three20 removed this method without really making as big of a news flash about it as it should have. It took me a while to troubleshoot this, but basically you just need to change all calls to TTIsEmptyString to TTIsSetWithItems, for example:
if( !self.isLoading && !TTIsSetWithItems(_username) )
I hope this works for you.

Related

Undefined symbols for architecture armv7? What does this error mean?

I just marked all of my CocoaAsyncSocket code as non-ARC code, and it's given me these 3 errors:
Undefined symbols for architecture armv7:
"_kCFStreamNetworkServiceTypeVoIP", referenced from:
-[GCDAsyncSocket enableBackgroundingOnSocketWithCaveat:] in GCDAsyncSocket.o
"_kCFStreamNetworkServiceType", referenced from:
-[GCDAsyncSocket enableBackgroundingOnSocketWithCaveat:] in GCDAsyncSocket.o
"_kCFStreamPropertySSLSettings", referenced from:
-[GCDAsyncSocket maybeStartTLS] in GCDAsyncSocket.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Does anybody know what this means and how to fix it?
I think I found the solution to this, by looking in the code comments, but I now see that it's also what Mark Adams suggested above. I had the errors until I added the CFNetwork.framework under Targets->Build Phases->Link Binary With Libraries->Select CFNetwork.framework
It means that some code you are compiling is referencing the constants "kCFStreamNetworkServiceTypeVoIP", "kCFStreamNetworkServiceType", and "kCFStreamPropertySSLSettings", but that those constants weren't found when it tried to link your code with the libraries it uses.
Unfortunately there's a bunch of reasons this could be:
You could have misspelled them
They could be #ifdef'd out for that architecture
You might not be linking the correct librar(y, ies)
They could be marked as having 'hidden' visibility so that they can only be used in the declaring library
Probably other reasons
You can use 'nm' to poke at the exported symbols from the binary of a library, and 'otool -L' to check which libraries your binary is linking.
I had this same error when integrating LineaPro API into an app.
The fix i implemented was adding ExternalAccessory.framework to General -> Linked Framework and Libraries.
I already had CFNetwork.framework included.

"_OBJC_CLASS_$_DBAccess", referenced from:

Trying to build my program and getting the following error. Don't see anything obvious. All my import statements seem correct:
Undefined symbols:
"_OBJC_CLASS_$_DBAccess", referenced from:
objc-class-ref-to-DBAccess in LocationsViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
This sort of problem usually means that the linker isn't finding the class (if your imports are wrong you only get a lexing warning).
Check to make sure that your project is properly linked to whatever uses DBAccess and that DBAccess.m/h is included in the output.

xcode collect2: ld returned 1 exit status - how to resolve?

From what I have read this is supposed to be when the linker (not exactly sure how that works) can't find a symbol. the symbol in question is: SCNetworkReachabilityCreateWithAddress as can be seen from the full error message below.
the thing is that the correct
framework is added to my target.
xcode recognises the symbol OK, i.e.
there is no error message in the .m
file.
the .m file is added to the correct
target so I'm not at all sure what to
do.
Any ideas please?
"SCNetworkReachabilityCreateWithAddress", referenced from:
-[AppWelcomeVC viewDidLoad] in AppWelcomeVC.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Do you have #import <Availability.h> in your AppWelcomeVC class header, or added to your precompiled header (MyApp_Prefix.pch)?
What frameworks do you have in your project?
In the past when I've had this error removing the framework and readding it fixed the problem.
Permissions problems with the framework file itself can also cause this error.

Help using SFHFKeychainUtils

I'm trying to use SHFHKeychainUtils in my project, but I keep getting the following error when I build:
".objc_class_name_SFHFKeychainUtils", referenced from:
literal-pointer#__OBJC#__cls_refs#SFHFKeychainUtils in ResultsViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
I added Security.framework via Target > Get Info > General
Any help would be greatly appreciated, thanks.
It's because you haven't added the files SFHFKeychainUtils (.h and .m) to your project, or that they aren't included for your target (check this by making sure the check-box at the right of the line for this file is checked).

Xcode CGRectZero Error

I am getting the following error when compiling my code
"_CGRectZero", referenced from:
_CGRectZero$non_lazy_ptr in RootViewController.o
_CGRectZero$non_lazy_ptr in SecondViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Build failed (1 error)
could someone tell me a solution to solve this?
Sounds like your project is missing a framework.
Right-click on the Frameworks folder in your project's Groups & Files column, then select Add > Existing Frameworks...
Choose CoreGraphics.framework from the frameworks list.
Once you rebuild, this error should go away (unless it is something else).