私は iPhone 開発に比較的慣れていないので、これは私のせいかもしれませんが、私が見たものとは逆です。:)
私は、「if」ステートメントのこの真空に住む UIAlertView を作成していると思います。
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
if(!data)
{
// Add an alert
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Unable to contact server"
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
NSLog(@"retain count before show: %i", alert.retainCount);
[alert show];
NSLog(@"retain count before release: %i", alert.retainCount);
[alert release];
NSLog(@"retain count after release: %i", alert.retainCount);
return nil;
}
ただし、コンソール ログは私を困惑させます。
retain count before show: 1
retain count before release: 6
retain count after release: 5
私も追加しようとしました:
alert = nil;
リリース後。これにより、保持カウントは 0 になりますが、それでもリークが表示されます。それが役立つ場合、リークの責任フレームは UIKeyboardInputManagerClassForInputMode です。OS 4 Beta 3 も使用しています。
-show を呼び出すと、ローカルの UIAlertView の保持カウントが 5 ずつ増加する方法を知っている人はいますか?
ご協力いただきありがとうございます!