Location Manager error - iphone

I am using location manager
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CLLocationManager", referenced from:
objc-class-ref in ViewController.o
"_kCLLocationAccuracyHundredMeters", referenced from:
-[ViewController viewDidLoad] in ViewController.o
"_kCLDistanceFilterNone", referenced from:
-[ViewController viewDidLoad] in ViewController.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
I added corelocation.framework into frameworks folder of my project, the project is success on cleaning but failed and give the same three errors on building

You need to import Framework Which you have already done also add the following to your .h file where you are using the CLLocation class such as
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
#interface UntitledViewController : UIViewController <CLLocationManagerDelegate> {
CLLocationManager* locationManager;
CLLocation* locationObject;
}
#end
Hope it helps!!

Removing and adding the framework back, is the correct solution.
Thank for the answer, it saved me a lot work.

Try adding this to your class
#import <CoreLocation/CoreLocation.h>

I was facing the same problem in my unit test project.
Problem was that I added CoreLocation.framework to my project but forget to add in unit test project.

Related

How do I link the libSCFoundationCMSApp.a & libPMAnalytics-r69.a libs and fix this error

I am taking over a really old iPhone project. I am getting these errors when I compile. Do I have libSCFoundationCMSApp.a & libPMAnalytics-r69.a in the wrong locations or am I just missing the libs that the app needs to properly use them?
".objc_class_name_NSNull", referenced from:
literal-pointer#__OBJC#__cls_refs#NSNull in libSCFoundationCMSApp.a(NSDictionaryAdditions.o)
literal-pointer#__OBJC#__cls_refs#NSNull in libSCFoundationCMSApp.a(XMLAdditions.o)
literal-pointer#__OBJC#__cls_refs#NSNull in libSCFoundationCMSApp.a(FMDatabase.o)
literal-pointer#__OBJC#__cls_refs#NSNull in libPMAnalytics-r69.a(Beacon.o)
literal-pointer#__OBJC#__cls_refs#NSNull in libPMAnalytics-r69.a(PMJSONUtils.o)
literal-pointer#__OBJC#__cls_refs#NSNull in libPMAnalytics-r69.a(PMFBXMLHandler.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
It sounds to me more likely that those libraries aren't linked properly to Foundation.framework.
Its complaining that it can't find the NSNull class name as a symbol and that it was referenced from within those libraries.

Reference library cyberlink

I reference the CyberLink library inside another target in an iPhone project.
But I have some bugs while compiling when I implemented a CyberLink class.
those kind of errors :
Undefined symbols:
"_xmlParseDocument", referenced from:
_cg_libxml2_parsewrapper in libCyberLink.a(cxml_parser_libxml2.o)
"_xmlGetPredefinedEntity", referenced from:
_cg_libxml2_get_entity in libCyberLink.a(cxml_parser_libxml2.o)
"_xmlCreateMemoryParserCtxt", referenced from:
_cg_libxml2_parsewrapper in libCyberLink.a(cxml_parser_libxml2.o)
"_xmlFreeParserCtxt", referenced from:
_cg_libxml2_parsewrapper in libCyberLink.a(cxml_parser_libxml2.o)
"_xmlFreeDoc", referenced from:
_cg_libxml2_parsewrapper in libCyberLink.a(cxml_parser_libxml2.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
If somebody can help me, it would be nice =)
You have to add -lxml2 in the "other linker flags" properties of the build tab in the info of your target.

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.

iPhone CAAnimation problem

I am getting the following errors when I try to use the CAAnimation constants, in a program I just wrote. I am able to run the "ViewTransitions" example (from the apple library, http://developer.apple.com/iphone/library/samplecode/ViewTransitions/index.html), and I do not see anything that has been done there, that I haven't :mad:.
P.S. - I did include QuartzCore/QuartzCore.h ..
"_kCAMediaTimingFunctionEaseInEaseOut", referenced from:
_kCAMediaTimingFunctionEaseInEaseOut$non_lazy_ptr in EMISNewsWebViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
"_kCATransitionFromTop", referenced from:
_kCATransitionFromTop$non_lazy_ptr in EMISNewsWebViewController.o
"_kCATransitionPush", referenced from:
_kCATransitionPush$non_lazy_ptr in EMISNewsWebViewController.o
".objc_class_name_CAMediaTimingFunction", referenced from:
literal-pointer#__OBJC#__cls_refs#CAMediaTimingFunction in EMISNewsWebViewController.o
".objc_class_name_CATransition", referenced from:
literal-pointer#__OBJC#__cls_refs#CATransition in EMISNewsWebViewController.o
"_kCAMediaTimingFunctionEaseInEaseOut", referenced from:
_kCAMediaTimingFunctionEaseInEaseOut$non_lazy_ptr in EMISNewsWebViewController.o
Any help will be greatly appreciated.
Check if you have added QuartzCore.framework to link to your project.

Why can't I do any CABasicAnimation or Keyframe animation stuff?

For some reason Xcode tells me that it doesn't find symbols as soon as I use something like kCAFillModeForwards. There must be a library or class that I have to include...but which one? The normal Core Animation stuff works fine like [myView beginAnimations...]. What's the trick to get the more sophisticated animation stuff to work?
I've included in the .h file:
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
#interface TestClass : UIView {
}
// ...
I run this code:
- (void)testAnimation {
CABasicAnimation *fadeInAnimation = [CABasicAnimation animationWithKeyPath:#"opacity"];
[fadeInAnimation setToValue:[NSNumber numberWithFloat:1.0]];
fadeInAnimation.fillMode = kCAFillModeForwards;
fadeInAnimation.removedOnCompletion = NO;
// other stuff deleted to limit error possibilities...should at least compile
}
This happens when I build (did clean up lots of times), 2 Errors:
cd "/Users/thanks/Desktop/Thanks/iPhone Development/TestApp"
setenv MACOSX_DEPLOYMENT_TARGET 10.5
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.0 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk "-L/Users/thanks/Desktop/Thanks/iPhone Development/TestApp/build/Debug-iphonesimulator" "-F/Users/thanks/Desktop/Thanks/iPhone Development/TestApp/build/Debug-iphonesimulator" -filelist "/Users/thanks/Desktop/Thanks/iPhone Development/TestApp/build/TestApp.build/Debug-iphonesimulator/TestApp.build/Objects-normal/i386/TestApp.LinkFileList" -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework CoreGraphics -o "/Users/thanks/Desktop/Thanks/iPhone Development/TestApp/build/Debug-iphonesimulator/TestApp.app/TestApp"
Undefined symbols:
".objc_class_name_CABasicAnimation", referenced from:
literal-pointer#__OBJC#__cls_refs#CABasicAnimation in TestClassTestClass.o
"_kCAFillModeForwards", referenced from:
_kCAFillModeForwards$non_lazy_ptr in TestClass.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
".objc_class_name_CABasicAnimation", referenced from:
literal-pointer#__OBJC#__cls_refs#CABasicAnimation in TestClass.o
"_kCAFillModeForwards", referenced from:
_kCAFillModeForwards$non_lazy_ptr in TestClass.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
It says Undefined symbols:
Must I include some framework?
I have already included:
CoreGraphics.framework
Foundation.framework
UIKit.framework
When I remove all the code, but import QuartzCore/QuartzCore.h, then I don't get any error. So I bet that import works, but not sure.
SOLVED
I missed to include the QuartzCore framework!!
Are you importing quartz in your header?
#import <QuartzCore/QuartzCore.h>
QuartzCore includes the CAAnimation headers
Probably you did not include the Quartz framework in your project.
To do so, choose your application target, go to the Build Phases tab and then under Link Binary With Libraries add the QuartzCore.framework.