I think the error is with the path, but I got the code (slightly modified) off a tutorial online for a Mac App, and it worked fine. It wrote to client_state.xml (in the build folder). However on my iphone navigation based app, it compiles and runs fine. And if I NSLog the data or the document I get the corresponding information, I just can’t find the .xml file anywhere.
//doc_client is a DDXMLDocument file from kissXML. The XMLData message returns the NSData
//from the document
NSData *xmlD = [doc_client XMLData];
[xmlD writeToFile:@"client_state.xml" atomically:YES];
The file path is relative to the current working directory of your app; if the application is sandboxed and the current directory is outside the app bundle, the
writeToFile:atomically:method will fail.Try providing an absolute path constructed dynamically based on the main bundle.