Try below code......let me know it is working or not!!!!
what you have done is you have given other button nil 2 times..so may be that is the problem...
Happy Coding!!!!
if ([textField.text length]==0)
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"MyApp" message:@"Please Enter Valid Data..." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
}