How to read file.xml from resources to NSString with format?

Posted by falkon on Stack Overflow See other posts from Stack Overflow or by falkon
Published on 2010-05-28T18:11:36Z Indexed on 2010/05/28 18:11 UTC
Read the original article Hit count: 109

Filed under:
|
|

Actually I have such a code:

NSString   *path = [[NSBundle mainBundle] pathForResource: @"connect" ofType: @"xml"];
NSError    *error = nil;
NSString   *data = [NSString stringWithContentsOfFile: path 
                                                         encoding: NSUTF8StringEncoding 
                                                            error: &error];
NSString *message = [NSString stringWithFormat:data, KEY, COUNTRY_ID];

which reads the connect.xml from resources. But on the formating the string (message) APP quits without displaying any errors. How can I read file.xml from resources to NSString with format?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about cocoa-touch