If you know the encoding of the text on the website will always be the same, you can use the method:
- (id)initWithContentsOfURL:(NSURL *)url encoding:(NSStringEncoding)enc error:(NSError **)error;
instead.
I'd also suggest performing network operations in the background:
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0),
^{
NSError *error;
NSString *myHtml = [[NSString alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://www.gcsp.webuda.com/hi.htm"] encoding:NSUTF8StringEncoding error:&error];
UIAlertView *message1 = [[UIAlertView alloc] initWithTitle:myHtml
message:myHtml
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
//UI updates should be on main thread
dispatch_async(dispatch_get_main_queue(),
^{
[message1 show];
});
});