简体   繁体   中英

Why am I getting this Parse Issue in Xcode?

I'm currently learning Objective-C and app development, but I'm also using a canned framework (buzztouch) to develop simple apps. Currently, I'm getting this Parse Issue:

'theTitle' used as the name of the name of the previous parameter rather than as part of the selector

Here's the line of code:

-(void)showAlert:(NSString *)theTitle:(NSString *)theMessage:(int)alertTag;

What am I doing wrong and how can I avoid this in the future? Sorry if this is an easy question, I'm just trying to learn how all of this works.

Compare the two:

Your code:

-(void)showAlert:(NSString *)theTitle:(NSString *)theMessage:(int)alertTag;

Now, look at this:

-(void)showAlert:(NSString *)theTitle theMessage:(NSString *)theMessage alertTag:(int)alertTag;

The problem is in the way you have declared your method:

Here is some detailed information on declaring your methods: Mac Developer Library . Take a look at the section titled Methods and Messaging .

I find it useful to compare Objective C methods to C++ or C# style methods.

in C#

public int Add(int number1, int number2) { 
     return number1 + number2;
}

in Objective C

- (int)add:(int)number1 toNumber:(int)number2 {
    return number1 + number2
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM