Check with below code:
if ([textField.text length]==0)
{
UIAlertView *objAlertMsg = [[UIAlertView alloc] initWithTitle:@"MyApp"
message:@"Please Enter Valid Data..."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[objAlertMsg show];
[objAlertMsg release];
}
Check that, I have set delegate to "nil" instead of "self". And make sure you have not implement delegate in view controller if it's not required.
Hope it will be helpful to you.
Cheers.