Warnings with NSString
I have the lines
usernameString = [[NSString alloc] initWithFormat:[username text]];
[username setText:usernameString]; // <--- warning Format not a string literal and no format arguments
username is a UITextField 开发者_运维问答
Tell me if you need anymore info
If you just want to duplicate the string, you can do that using initWithString:
, which gives you back a new string with the same contents as the string passed in:
usernameString = [[NSString alloc] initWithString:[username text]];
Try:
usernameString = [[NSString alloc] initWithFormat:@"%@",[username text]];
Don't forget to release usernameString
later, if you need to.
精彩评论