ドキュメントや投稿が見つからないという奇妙なエラーがあります。標準の教科書メソッドを使用してWebサービス(プライバシーのために変更されたURL)に接続しようとすると、[NSURLConnectioninitWithRequest]でEXC_BAD_INSTRUCTIONまたはEXC_BAD_ACCESSを受け取ります。
最も奇妙なことは、問題のある行を例外なくステップオーバーできる場合がありますが、10回のうち9回は、このエラーが発生します。助言がありますか?
- (void)viewDidLoad {
NSURL *url = [NSURL URLWithString:@"http://heres/where/my/webservice/url/is/"];
NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:30.0];
// cancel any old connection
if(connection) {
[connection cancel];
[connection release];
}
// create new connection and begin loading data
connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
if(connection) {
// if the connection was created correctly, release old data (if any), and alloc new
[data release];
data = [[NSMutableData data] retain];
}
[url release];
[request release];
}
ヘルプや提案、RTFMは大歓迎です!