You can start a new thread. Add this before you you start your javascript function
[NSThread detachNewThreadSelector:@selector(loadAnimation) toTarget:self withObject:nil];
Then add whatever animation you want...
- (void)loadAnimation {
//Animation stuff here
}
You could try and run "step 3" immediately after your javascript stuff. So in all you would have
- (void)someMethod {
//start your animation
[NSThread detachNewThreadSelector:@selector(loadAnimation) toTarget:self withObject:nil];
//run javascript
NSString *resultMess = [webView stringByEvaluatingJavaScriptFromString:_scriptMethod];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"title" message:@"message" cancelButtonTitle:@"Okay" otherButtonTitles:nil];
[alert show]
}
If the javascript is causing your app to stall then the alert shouldn't pop up until after it finishes.