I have a problem with [NSString strigWithFormat:format]
because it returns an id, and I have a lot of code where I changed a NSString var to an other personal type. But the compiler does not prevent me that there are places where a NSString is going to be set into another type of object.
So I'm writing a category of NSString and I'm goind to replace all my calls to stringWithFormat
to myStringWithFormat
.
The code is :
@interface NSString (NSStringPerso)
+ (NSString*) myStringWithFormat:(NSString *)format;
@end
@implementation NSString (NSStringPerso)
+ (NSString*) myStringWithFormat:(NSString *)format {
return (NSString*)[NSString stringWithFormat:format];
}
@end
The compiler tells me that "Format not a string literal and no format arguments".
Do you see any way to make this work ?