2012-08-06 173 views
3

以下两种方法在我的一个控制器中。 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 


} 

回答

8

你有两个支架出于某种原因...

[self workWithAString:modifiedString1]; 
+1

不能相信我错过了。非常感谢。 – K17 2012-08-06 17:45:18