私はARCを使い始めています。最初に試してみたことの1つは、URLへのHTTP呼び出しを行い、データを取り戻すことでした。それは私が私の「後藤」のようなsendSynchronousRequest
を使用してのに行ってきました意味のでもちろん、HTTPステータスコードは、私にとって重要である:NSURLConnection ARCを使ってsendSynchronousRequestを呼び出す
NSError *error = [[NSError alloc] init];
NSHTTPURLResponse *responseCode = nil;
NSData *oResponseData = [NSURLConnection sendSynchronousRequest:request returningResponse:responseCode error:error];
ARCで、私はその最後の行に、コンパイラのエラーと警告を取得可能となりました。
エラー:
Implicit conversion of an Objective-C pointer to 'NSURLResponse *__autoreleasing *' is disallowed with ARC
Implicit conversion of an Objective-C pointer to 'NSError *__autoreleasing *' is disallowed with ARC
file://localhost/Users/jason/Projects/test/Data/DataService.m: error: Automatic Reference Counting Issue: Implicit conversion of an Objective-C pointer to 'NSURLResponse *__autoreleasing *' is disallowed with ARC
file://localhost/Users/jason/Projects/test/Data/DataService.m: error: Automatic Reference Counting Issue: Implicit conversion of an Objective-C pointer to 'NSError *__autoreleasing *' is disallowed with ARC
警告:
私は参照渡しを伝えることができるものから、Incompatible pointer types sending 'NSHTTPURLResponse *_strong' to parameter of type 'NSURLResponse *_autoreleasing *'
Incompatible pointer types sending 'NSError *_strong' to parameter of type 'NSError *_autoreleasing *'
がこれをめちゃくちゃにされたものですが、私は何を正しい道にわかりませんよ解決してください。 ARCと同様のタスクを達成する「より良い」方法はありますか?
LOLは休日の後に考えようと私に役立ちます! –