Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jsnuff1

macrumors 6502a
Original poster
Oct 4, 2003
726
333
NY
Im creating a program that has a lot of C++ code back-end which is heavily dependent on the libxml framework.

Is there any reason why this framework would not work with the iPhone? Everything compiles and runs fine, but when I try and load a XML file with this framework I get a failed to load I/O warning.

Anyone that knows about this framework chime in?
 

acanby

macrumors newbie
Aug 9, 2008
4
0
i had a similar issue, but i can assure you it works perfectly once you know where to look for your files - it took me ages to come across this thread: https://forums.macrumors.com/threads/499671/. the important part i put below

There's a whole section on Resource Management for the iPhone, but to save you the trouble of finding it on Apple's site - here's what I do. First, with your project open in XCode, right click the Resources folder in the tree on the left, select Add Existing file, select the XML file you want to add and check the Copy to local project folder checkbox (if the XML file doesn't already live with your other code files). This should make it show up in your Resources list along with your xib and plist files. When you build the application, it will bundle it up for you automagically. Then to get its file path in code do this:

Code:
NSString *path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"myFile.xml"];

HTH,

Enuratique

basically you have to tell the program where the file is located, without declaring it statically. if you go and have a look where the project is run from, /Users/xyz/Library/Application Support/iPhone Simulator/user/Applications you will be able to find your application (depending on how many apps you have installed in the simulator) and your xml file should show up in the documents folder. if its not, then you are doing something wrong
 

jsnuff1

macrumors 6502a
Original poster
Oct 4, 2003
726
333
NY
hey thanks for the reply, i figured that part out. Have you got your program to work successfully on the device with this framework? Everything works on the simulator for me, but once I try to compile for the device I get linker errors from the framework. If you got it working on the device can you tell me how you went about adding the framework with no linker errors?
 

acanby

macrumors newbie
Aug 9, 2008
4
0
yeah its working fine on the device... i set it up a while back but here goes

go get info on the project, and go to the build tab

im assuming that if its working in the simulator you have already added the -lxml2 to the "other linker flags"?

and the other bit is for the heading labeled "header search paths" put "/usr/include/libxml2/**" (from memory the ** sets it to be recursive)

and if that doesnt work, check here for the right path for libxml on the device: http://discussions.apple.com/thread.jspa?threadID=1442488&tstart=284
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.