user1855952
user1855952

Reputation: 1575

Calling function in Objective-C from an alertView based function

So I have an alert view and when I press enter into the alert view it calls this function:

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (buttonIndex == 1) {
     NSString *name = [alertView textFieldAtIndex:0].text;
    // name contains the entered value
    NSLog(name);
    if(login){
        LoginToProfile(name);
    } else if(createAccount){
        //AddAcount(name);
    }

  }
}

Now within this method as you can see I want it to be able to call another function defined in the same view controller that called/created the alert view. But the compiler doesn't like this.

I also get the warning "Implicit declaration of LoginToProfile is invalid in C99".

How do I fix this issue?

Upvotes: 1

Views: 222

Answers (1)

Peter Warbo
Peter Warbo

Reputation: 11728

That is not a c-function you have defined. It's an obj-c method which you need to call on the object itself. You call it like this [self LoginToProfile:name]

Upvotes: 2

Related Questions