Search code examples
iphoneuialertviewmethodnotfound

Alert View show me warning


When I use alertView using below code, it shows me the warning

warning: Semantic Issue: Method '-addTextFieldWithValue:label:' not found (return type defaults to 'id') 

Here is the code:

    UIAlertView *alSave=[[UIAlertView alloc]initWithTitle:@"Save as" message:@"Title the note and click Save" delegate:self cancelButtonTitle:@"save" otherButtonTitles:@"cancel", nil];
    NSArray *arr=[noteObj.noteTitle componentsSeparatedByString:@" - "];
    app.longClickId = [noteObj.noteId integerValue];
    [alSave addTextFieldWithValue:[NSString stringWithFormat:@"%@",[arr objectAtIndex:0]] label:@"Note Name"];
   // show me warning at this place

    textField = [alSave textFieldAtIndex:0];
    textField.keyboardType = UIKeyboardTypeAlphabet;
    textField.keyboardAppearance = UIKeyboardAppearanceAlert;
    textField.autocorrectionType = UITextAutocorrectionTypeNo;   // correction automatically

    [alSave show];
    if (app.NotePopOver!= nil) {
        [app.NotePopOver dismissPopoverAnimated:YES];

    }
    [alSave release];

Solution

  • That method is undocumented. You will have to create your own text field and then add it to the alert view.