意外的"预期标识符"错误

K17*_*K17 3 objective-c ios

我的一个控制器中有以下两种方法.buttonPressed方法连接到按钮并正常工作.但是,当我将调用添加到workWithAString时,出现错误.想知道我在这里失踪了什么,并感谢你的建议.

-(NSString *) workWithAString: (NSString *) string1
{

NSString *string2 = [[NSString alloc] initWithString:string1];

// Here I will do some other things with string2

return string2;

}


-(IBAction)button1Pressed
{
NSString *modifiedString1 = [[NSString alloc] initWithString:InputValue.text];
modifiedString1 = [[self workWithAString: modifiedString1 ];  // Expected identifier error here


}
Run Code Online (Sandbox Code Playgroud)

ohr*_*ohr 8

出于某种原因,你有两个括号......

[self workWithAString:modifiedString1];
Run Code Online (Sandbox Code Playgroud)