What's the best way to create an XML placeholder string in obj-c
I basically want to define an XML string in my header ie:
#define kXMLString "<?xml version=\"1.0\" encoding=\"utf-8\"?><xml>%@</xml>"
In in my code I then want to replace the placeholders ie:
NSString *xmlpMsg = [NSString stringWithFormat:kXMLString, @"value"];
However this gives me warnings/errors. What's the best way to开发者_如何学运维 go about this?
You forgot the @:
#define kXMLString @"<?xml version=\"1.0\" encoding=\"utf-8\"?><xml>%@</xml>"
or better:
const NSString *kXMLString = @"<?xml version=\"1.0\" encoding=\"utf-8\"?><xml>%@</xml>";
精彩评论