user2052639
user2052639

Reputation: 31

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.

Upvotes: 0

Views: 188

Answers (2)

Lance
Lance

Reputation: 9012

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
}

Upvotes: 2

Jeremy
Jeremy

Reputation: 9030

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.

Upvotes: 3

Related Questions