こんにちは
私はiPhoneのアプリケーションを開発しています。これは、WebからXMLページを読み込んで何かを行うべきです。問題は、アプリケーションがページをダウンロードしている間にアプリケーションがフリーズして見苦しくなることです。
「Loading、please」というメッセージを回転ホイールで表示したいのですが...
正しいアプローチは何ですか?
私はNSThread
を使用しようとしましたが、私はこのエラーが表示されます。
Obtaining the web lock from a thread other than the main thread or the web thread. UIKit should not be called from a secondary thread.
これは私がXMLページをロードするために使用していOBJ-Cのコードです:
ポップアップ/プログレスバーの読み込み
NSString* xmlUrl = [NSString stringWithFormat:@"http://urltothexmlpage"];
NSString* XML = [NSString stringWithContentsOfURL:[NSURL URLWithString:xmlUrl]
encoding:NSUTF8StringEncoding
error:nil];