I am trying to use GDataXMLNode to parse an XML file. I am following the tutorial on this blog:
http://www.raywenderlich.com/725/xml-tutorial-for-ios-how-to-read-and-write-xml-documents-with-gdataxml
My problem is trying to add the GDataXMLNode to my project and getting it to work. I'm supposed to do something with the configurations, add a Header Search Path, and a few other things, but every single example I've found online is for a previous version of Xcode. I'm currently using Xcode 5 and I have tried everything (PLEASE prove me wrong), but nothing is working the way it's supposed to in this tutorial.
So, any help as to how I might go about this and get it working together with my iOS project would be much appreciated. Let me know if I can expound on anything I've said.
You should select "All" in Project Settings to show all the parameters, including "Header Search Paths" and "Other Linker Flags".
It's quite easy, follow instruction but remember that GDataXMLNode does not support ARC. You can do the same instruction as Andrey. But I think it should be located in a sub-project, for example: Library.xcodeproj. If you want to organize your code formally.
Firstly, create Library.xcodeproject, add GDataXMLNode. In Build Settings, you also include "Header Search Path" and "Other Linker Flags". But don't forget that GDataXMLNode does not support ARC. Go to Build Phrases, under Compile Sources menu look for GDataXMlNode.m set a Compiler Flag for it with: -fno-objc-arc
Now, for any sub-project you want to use this library, just go to Build Settings, in User Header Search Path properties choose: ../IPLibrary/** or ../IPLibrary and choose rescursive option.
Now you can include GDataXMLNode. By the way, your project looks more professional, due to lib and source code is split separately. Good luck.
Related
I am working on an Xcode project that uses a Calendar framework, here: https://github.com/mmick66/CalendarView.
In the readme is says in order to use the Event system, you need to set custom swift compiler flags in the build settings. For some reason it isn't shown as an option for me.
Here is a screenshot of what I see in my projects build settings.
On the repository is a sample project. When I open that in Xcode, "Swift Compiler - Custom Flags" is one of the sections unlike my project.
Why would this be happening?
Here is a screenshot from the open source example project:
As per Richard Robinson's comment. I was able to find the required settings by restarting Xcode, and in the Build Settings tab, click all (combined is default) then searching for "custom flags". From there I was able to add the required flags for the calendar framework.
Edit 1: I jus thought I should add this clause to this answer. This doesn't technically answer the "why" is this happening, rather just how to fix it.
As a beginner in ObjectiveC I need some help.
I'm working on a phonegap plugin for IOS (so, written with objective C). I use some open source code but I got an error with an .h import.
My architecture look like:
myFmk.framework/
myFmk.framework/ABCDE/myFmk.h <== in a sub folder
myFmk.framework/myFmk <=== this is a file
myPlugin.h
myPlugin.m
In myPlugin.h I have #import and in "myFmk.framework/myFmk" file I have only one line "ABCDE/".
I thought that this file do a redirection of the absolute import (with brackets) but my complier told me that "myFmk/myFmk.h" is not found.
I tried to find some documentation about this feature but I wasn't able to find its name... do you have this documentation or the feature name?
Thks.
Is the framework added using a cocoapod? If not, did you follow the instructions properly for adding it to your project? It would probably help if you posted the framework you are experiencing problems with.
If this is a framework that is added to your project properly and you are unable to import there are a few things you should check. First, go to your project settings (click on the project at the very top of your file tree in the left column) and then look for "linked libraries". See if the library is listed there. If not click the + and try to add it.
If this framework was added via cocoapods another thing to check is search your file structure for libPods.a. If it is red, I find sometimes it is helpful to delete it, close the project and run pod install again.
Also if you installed the project via cocoapods remember to open the workspace and not the old xcode project file.
I have also experienced this problem when my header search paths and other linker flag paths were wrong. Linker Flags should be $inherited if this is a cocoapod. In my projects most Header search paths are $inherited too.
If none of this is helpful please provide more information such as how this framework was added to your project and what the framework is. Also let us know if you get any error messages.
I'm having trouble linking to a static library in Xcode 5. I did read the chapter on building and using a static library in the Pro iOS 5 Tools. What it told me to do after creating your static library, was to link against the framework in the Build Phases tab. That part is pretty straight forward. Then it says in the Build Settings, under "Header Search Paths", to add:
$(BUILT_PRODUCTS_DIR)
Then in order to use my static library, I just import it like so:
#import "ConversionCalculator/ConversionCalculator.h"
So this used to work up until yesterday. I tried adding a new static library to my project which didn't seem to work. So I cleaned my project, and tried rebuilding again, but now Xcode complains about #import "ConversionCalculator/ConversionCalculator.h". It says
Lexical or Preprocessor issue. 'ConversionCalculator/ConversionCalculator.h' file could not be found.
I was wondering if anyone has any tips on debugging this. I've looked through different tutorials like this:
http://blog.stevex.net/2012/04/static-libraries-in-xcode/
http://cocoamanifest.net/articles/2011/06/library-management-with-xcode-workspaces.html
http://www.raywenderlich.com/41377/creating-a-status-library-in-ios-tutorial
But I can't seem to find the "golden way" to link to a static lib, or how to troubleshoot why Xcode cannot find my file. My file structure is setup on my machine like so:
Projects\
DistanceCalculator\DistanceCalculator.xcodeproj
ConversionCalculator\ConversionCalculator.xcodeproj
DistanceCalculator.workspace
Like I said, this all used to work too when I followed the tutorial in Pro iOS 5 Tools book. Now I don't know why my workspace cannot find ConversionCalculator when it has used it before. The part I find hard is different articles say different things about the header search path, and I'm not sure what the best way to populate that field is. Any thoughts? Thanks in advance!
Edit:
I'll add that I can build for the device without errors. But when I switch to the iPhone simulator, it gives me that error about not being able to find the file. I also see that I get this warning:
ConversionCalculator was rejected as an implicit dependency for 'libConversionCalculator.a' because its architectures 'i386' didn't contain all required architectures 'i386 x86_64'
Looking at that, I'm not sure what that means. If it means that my library is not being built for all architectures, I just tried creating a Target that builds for all architectures according to the wenderlich article in the above link. That seems to work as when I go to the dervieddata folder, I see for debug, release, and universal, I see the libConversionCalculator.a file. But then when I go back into the workspace and try to rebuild the project for the simulator, I get that could not find file error and the implicit warning.
Edit #2:
I just saw a warning flag on Xcode that says upgrade to recommended Build Settings. Now I get no errors. Not sure what happened... but I guess no errors is good.
I would follow the description available in Xcode's Help topic "Linking Against Your Library" in chapter Configuration Your Application in Introduction to Using Static Libraries in iOS
(you may search within Xcode Help, too).
Except that I would recommend to include your headers from libraries always using angle brackets:
#import <ConversionCalculator/ConversionCalculator.h>
Using double quotes may inadvertently search and find files with the same name in some sub-folder relative to the file where this import directive is written. Only after there was no file in any sub-folder the preprocessor starts searching with the specified header search paths.
Using angle brackets, the preprocessor immediately searches only at the specified header search paths.
So, since you actually want to find headers for the corresponding library, always use angle brackets.
Note: If you follow the recommendation to create a static library project, you don't need to explicitly set a header search path in the target that links agains the library: Xcode will already add a search path:
$(BUILT_PRODUCTS_DIR)/includes
Your library headers are located in
$(BUILT_PRODUCTS_DIR)/includes/<product-name>
which are placed there through the "Copy-Files" phase of the iOS static library target, whose "Destination" is set to "Products Directory" and whose "Subpath" is set to "includes/${PRODUCT_NAME}" per default.
You may change these default settings to other reasonable and sensible values. (if you do, consider the the consequences for Xcode's default search paths!)
So I feel like this should be a simple problem, but I can't get the
'kazmath/...h' file not found
error to disappear (specifically kazmath.h and mat4.h. This might be an extension (or revisit) of this question.
Here's an overview. I have a workspace for games and adding them individually as sibling projects. The one I just added uses Cocos2d. It seems to compile by itself, but when I try to link it to the workspace, the workspace gets errors that it can't find the kazmath folder. It is in the game project itself, and I have tried adding it to the workspace, but that doesn't seem to work.
Can anyone give a quick rundown on either adding projects to a workspace and linking them in or on how to properly link header files?
Some notes: I've added the path (Arcade/libs/kazmath/include/) in Header Search Paths for the build settings. I've added the -lz and -ObjC flags for the Other Linker Flags.
if you attempt to set Project Wide Header Search Paths section
and you forgot a wrong section in
in Target that maybe wrong overridden may cause keep this error occuring.
so delete targets>BLAHPROJ>Header Search Paths setting and keep this setting in ONLY Project Wide.
this fixes problem too
Maybe this is the same problem as I have, which I am answering here because I have not found anyone giving this answer and maybe it will solve this issue for others.
I kept "fixing" the path in my Project target but, using a demo project as a template which builds a separate Cocos2D target, I should have been changing the "Header Search Paths" there.
--forehead slap!--
I am a bear of very little brain.
in the last 4 hours I try to add Three20 to my iOS poject.
I try to avoid it a long time but now I am on a point in which i can't :)
So I added it correctly all to my projects and after around 2 hours of work it compile perfectly!!!
Badly, I got a "No such file or directory found"-error when try to
#import "Three20/Three20.h"
I try nearly every string in the "Header search paths" I can imagine to get this working, but I have no idea...
here is a screenshot of my directory listing:
http://i.stack.imgur.com/9yWjM.png
here is my Header search paths:
http://i.stack.imgur.com/uXEWP.png
What am I doing wrong?
Have you tried to add the three20 framework manually or using the included ttmodule.py script? The script usually takes care of everything. You can either import the framework into an old xcode3 or current xcode4 based project. The python script is located in src/scripts/
Short answer: everything. Three20 has a very clear documentation. Just follow the Adding Three20 to your project section from https://github.com/facebook/three20
At least for Xcode 4.2 and 4.3, you should do a previous step before you click on Product->Archive. This step is clicking on: Product -> Build for -> Build for archiving.
In USER_HEADER_SEARCH_PATHS in Build Setting under the Search Paths section add this:
$(BUILT_PRODUCTS_DIR)/../../three20
$(BUILT_PRODUCTS_DIR)/../three20