Hey guys,

I'm trying to make my first iphone application and have encountered some errors as expected. I am trying to uitlize UIAlertView to check if the setter for a password and email instance has been filled. If they are nil, then the alert should be invoked and display the given messages in the alert window. My code is as follows:

-(IBAction)verifyCredentials:(UIButton *) sender
{
    if(!_passwordField || !_emailField)
    {
        UIAlertView *alert = [[UIAlertView alloc] initwithTitle:@"Oops!"
                                                        message:@"You must fill all required fields"
                                                       delegate:nil
                                              cancelButtonTitle:@"Ok"
                                              otherButtonTitles:nil];
        [alert show];
    }

    //rest of code..
}

Here are the setters for the _passwordField & _emailField objects:

-(void) setPasswordField:(UITextField *)passwordField
{
    _passwordField = passwordField;
}

-(void) setEmailField:(UITextField *)emailField
{
    _emailField = emailField;
}

The error I receive when trying to use UIViewAlert is "Receiver type 'UIViewAlert' for instance does not delcare a method with selector 'initwithTitle:message:delegate:cancelButtonTitle:otherButtonTitles:'"

Why am i receiving this and how do I fix it?

And as an aside, I am very comfortable with c++ and have heard of the term "objc++," would any of you recommend using c++ to build ios applications? If so, how would I use the c++ classes to intereact with UI?

Thanks for your help & taking your time to read this!

change the first parameter to be initWithTitle (ie capitalise the W)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.