我今天刚刚发现了 XCode 的 Build > Analyze 功能,所以我试图通过并解决它发现的所有错误。有几行 XCode 发现异常让我感到困惑:
//Test View
self.imageViewTest = [[UIImageView alloc] init];
self.imageViewTest.frame = CGRectMake(0, 0, 100, 100); // <=== Leak
[self.view addSubview:self.imageViewTest];
//Test View 2
self.imageViewTestB = [[UIImageView alloc] init];
self.imageViewTestB.frame = CGRectMake(0, 100, 100, 100); // <=== Leak
[self.view addSubview:self.imageViewTestB];
后来在我的视频捕获设置中
self.captureOutput = [[AVCaptureVideoDataOutput alloc] init];
captureOutput.alwaysDiscardsLateVideoFrames = YES; // <=== Leak
这些行中的每一行的警告都是“对象的潜在泄漏”。所有这 3 个对象都release
在我的dealloc
方法中发送消息。这里有什么问题?
谢谢!