开发者

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>";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜