Error while implementing KMLViewer in my project - iphone

I have included the class KMLParser.m of Apple's KML Viewer in my project.The problem that I have is that when I try to build the project i get two errors like these:
_CLLocationCoordinate2DMake,referenced from:
_strToCoords in KMLParser.o
_CLLocationCoordinate2DisValid, referenced from:
_strToCoords in KMLParser.m
I don't have any idea why this error occurs, because i have left the files KMLParser.m and KMLParser.h intact, I haven't made any change to them.When I build KML Viewer, everything is fine. Please,illuminate me.

I am also working on implementing KMLViewer in my project. Turns out that accidentally linking with the incorrect target will cause the same errors.
For XCode 4.x, under the list of Targets, it could be that there are multiple targets, such as MyApp and MyAppTests. Select the correct target (e.g., MyApp), then add the framework(s).

You need to add the Core Location framework to your project (an #import alone is not enough).
For Xcode 3.x, right-click on the project file and go to Add - Existing Frameworks.
For Xcode 4.x, see How to "add existing frameworks" in Xcode 4?.

Related

Externally added frameworks are not copied when project is copied in xcode

I have added external frameworks from my mac's Documents folder into my project.
Now when I copy this project to someother place and compile them I m getting errors .Its becoz those frameworks are not copied.Those frameworks appear to be in red colur in Frameworks group.
How can I make all the custom added frameworks to be copied when the project is copied to a newer place?
Add these framework first of all under build phases in link binary with libraries means drag & drop these framework there first & then try to add in another place.try it.

Installing Core-Plot in Xcode 4.2 for iOS project

I am trying to install Core Plot into my iOS app. I have followed the instructions on the Core Plot website but they are very brief and have no screenshots. I have pasted the instructions below and explained where I am stuck...
First, drag the CorePlot-CocoaTouch.xcodeproj file into your iPhone
application's Xcode project. Show the project navigator in the
left-hand list and click on your project.
Select your application target from under the "Targets" source list
that appears. Click on the "Build Phases" tab and expand the "Target
Dependencies" group. Click on the plus button, select the
CorePlot-CocoaTouch library, and click Add. This should ensure that
the Core Plot library will be built with your application.
Done!
Core Plot is built as a static library for iPhone, so you'll need to
drag the libCorePlot-CocoaTouch.a static library from under the
CorePlot-CocoaTouch.xcodeproj group to the "Link Binaries With
Libraries" group within the application target's "Build Phases" group
you were just in.
Done!
You'll also need to point to the right header location. Under your
Build settings, set the Header Search Paths to the relative path from
your application to the framework/ subdirectory within the Core Plot
source tree. Make sure to make this header search path recursive. You
need to add -ObjC to Other Linker Flags as well (as of Xcode 4.2,
-all_load does not seem to be needed, but it may be required for older Xcode versions).
I dont understand this bit!
Core Plot is based on Core Animation, so if you haven't already, add
the QuartzCore framework to your application project.
Done!
Finally, you should be able to import all of the Core Plot classes and
data types by inserting the following line in the appropriate source
files within your project:
#import "CorePlot-CocoaTouch.h"
Done!
Is anyone able to put the instruction I am struggling with into more laymans terms?
Seeing as how I wrote those instructions, I can take a stab at clarifying the part you're having trouble with.
You'll need to set the header search path so that when you include CorePlot-CocoaTouch.h, Xcode knows where to pull that from. This is located within the Build Settings for your application project under the Header Search Paths build setting. It looks like the following:
Double-click on the field for the header search paths and bring up this popup:
The path you specify here is the relative path from your Xcode project file to the directory where you installed Core Plot. In my case, I had both my application project directory and Core Plot located within the same ~/Development directory, so the relative path involved stepping back a level (the ../) and going to the core-plot directory that I had cloned the framework into. You then need to point to the framework subdirectory, where the actual framework source is stored.
Finally, checking the little box to the left of the path makes the header search recursive, so it will find headers contained in subdirectories of this one.
As far as the linker flags go, find your Other Linker Flags within these same Build Settings and add -ObjC to the list of linker flags:
This is needed so that symbols from the categories we use in the static library get pulled into your project properly. As I indicate, we used to need to add -all_load to this as well to work around a linker bug, but LLVM in Xcode 4.2 fixes this. That's good, because -all_load sometimes introduced duplicate symbols and broke building against certain third-party frameworks.
Hopefully, this should clear up that particular section of the instructions. I tried to do my best to make those easy to follow and keep them up to date with the latest Xcode versions, but perhaps I wasn't detailed enough. If you got through all the rest of the steps fine, you should be good to go.
The easiest way is to include the core-plot .h files and the library binary files (the .a file).
You just drag them all into the project.
Cheers.

ios iPhone / iPad - Project with GData static library libGDataTouchStaticLib.a fails on build (duplicate symbol)

I am trying to build an App using the GData static library libGDataTouchStaticLib.a
I have made all the appropriate linkings in my project settings and have copied GDataXMLNode.h and GDataXMLNode.m to my project.
I am receiving the error below. Can someone help me understand what this is?
ld: duplicate symbol _kGDataXMLXPathDefaultNamespacePrefix in
/Users/myUser/Library/Developer/Xcode/DerivedData/GData-edmqtrniowvhfjgfgngtlfxttvri/Build/Products/Debug-iphoneos/libGDataTouchStaticLib.a(GDataXMLNode.o) and
/Users/myUser/Library/Developer/Xcode/DerivedData/MyApp-grzimbvctfmwhmdluxbuxmskcvzy/Build/Intermediates/MyApp.build/Debug-iphoneos/MyApp.build/Objects-normal/armv7/GDataXMLNode.o for architecture armv7
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/clang failed with exit code 1
You shouldn't have to copy in GDataXMLNode.h and GDataXMLNode.m to your project. I believe the reason you are getting the duplicate symbol error is because the libGDataTouchStaticLib.a library already contains the compiled GDataXMLNode.m class.
I am currently using the GData library in a project I am working on, and got it set up by using these instructions: http://hoishing.wordpress.com/2011/08/23/gdata-objective-c-client-setup-in-xcode-4/, so this answer assumes that you have the same setup. However I have used a slightly different way of importing the headers that was suggested by one of the comments on the above blog.
In your Xcode project remove the GDataXMLNode.h and GDataXMLNode.m files, and make sure that the GData.xcodeproj project is linked into your project the same way as in the above blog, but do not drag the headers directory to your source tree. Add these arguments to the Debug and Release Header Search Paths of your current target instead:
/usr/include/libxml2
${BUILT_PRODUCTS_DIR}/Headers
You can find this under the Build Settings tab of your target. The second argument will import all the GData headers into your project if you have set up the GData.xcodeproj file correctly. Once you have done this you should be able to import the various GData classes including GDataXMLNode.h class wherever you need it by typing this at the top of the appropriate class:
#import "GDataXMLNode.h"
Much credit goes to Kelvin's blog for his great tutorial. Hope that helps!

objc_class$____ error

For my application i need to work with calendar.
http://blog.webscale.co.in/?p=244 from this link i downloaded required stuff.....
related to calendar.... now i need to import it into my application.
Even i added all the required framework in my application. its showing me error...
"_OBJC_CLASS_$_CheckmarkTile", referenced from:
Any one help me out. What to do..
This _OBJC_CLASS_$_ Error comes if you dont include the framework for that corresponding Object class. In your case this CheckmarkTile.
If you have included this calendar component in your project. Then rightclick frameworks group in xcode add Existing Frameworks. The Select AddOther and include the build file of that calendar project. Now Clean Build and run.
Or Just try this
Just include the ChemarkTile .h and .m files into your project and then clean build
Make sure it's added to your target to compile. As stated above...
Just include the ChemarkTile .h and .m files into your project and then clean build

Thrift framework for iPhone

I'm currently stuck trying to get my objective c generated files to compile in my iPhone project. Basically it keeps telling me there is no such directory for the following four imports:
Thrift/TProtocol.h
Thrift/TApplicationException.h
Thrift/TProtocolUtil.h
Thrift/TProcessor.h
I'm following all the instructions on the Thrift wiki and have downloaded and compiled the Thrift framework in XCode but there is no information specific to iPhone development. I'm almost certain it's a problem specific to an iPhone project because if I create a new command line project in XCode, I can import those files just fine.
After retaining the services of some kind of sorcerer I have figured out how to get Thrift to work with the iPhone/iPad (or at least get it to compile okay).
First, you want to grab the objective-c files with this command instead of from the wiki:
svn co http://svn.apache.org/repos/asf/incubator/thrift/trunk/lib/cocoa/src/ thrift-cocoa
Then, make a new Xcode project by going to New Project, selecting Framework & Library and Cocoa Framework. Click create and save it somewhere nice. Right click on Targets and select Add -> New Target. Choose Cocoa Touch and then Static Library. Give it a nice name. Go to the target's Build tab in info and change the Base SDK to iPhone Device (I'm using 3.2 but you can use whatever) and change Architectures to either Standard (armv6 armv7) or Optimized (armv7). Under the General tab add the Foundation and Cocoa frameworks.
Drag all of the files and folders you got from the svn repository into the Classes folder in the project. Check the copy items box and check the boxes next to both targets. Remove TSocketServer.h and .m from the Static Library's Copy Headers and Compile Sources folders respectively. You can now build the Static Library (and Framework optionally).
Open the project you want to use Thrift in and go to your target's General tab in info. Add the Static Library you just created to the Linked Libraries list. It should be named libYOUR_TARGET_NAME.a. Under the build tab go to Header Search Paths and add the path to the Thrift project you just created and check the recursive box.
Finally you just need to change the import statements in the Thrift generated code by simply removing the brackets and replacing them with quotes. You can now build you iPhone project again.
Try adding those .h files to your Xcode project.