views:

36

answers:

1

Hi

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?

A: 

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>";
Philippe Leybaert
Sorry I did put the @ but somehow missed it in the question.What you suggested still doesn't work, the NSString version expects paramaters at the end but I don't want to use paramters yet, I want to add the paramaters in another part of the code.
dimos