I am trying to set the initial text for what the twitter message should say in my app using a NSString from my appDelegate. Check out the code here:
NSString *tweet;
tweet=[MyWebFunction tweet:appDelegate.stadium_id];
if([deviceType hasPrefix:@"5."]){
// Create the view controller
TWTweetComposeViewController *twitter = [[TWTweetComposeViewController alloc] init];
[twitter setInitialText:@"@%",tweet];
The problem is, is there is an error at the twitter setInitialText that there are Too many arguments to method call, expected 1, have 2. ?!?!?
Any help is greatly appreciated. 🙂

The
TWTweetComposeViewControllermethodsetInitialTextonly takes one argument, being of typeNSString*. You cannot simply format any and allNSStringvariables passed to a method as you can with theNSStringmethodstringWithFormat(which is, I imagine, where you’ve seen the syntax[NSString stringWithFormat:@"%@", myString]).In your case, you either need to simply call:
or call:
EDIT
I feel it necessary to add, to further your understanding, that a method only takes a variable number of arguments (such as
stringWithFormat) when its declaration ends with...For example, looking in the docs for
NSStringreveals thatstringWithFormatis declared as such:Similarly,
arrayWithObjectsinNSArrayis declared as such:which one would use like: