Terminate NSOperation Block save loop warning?
I have similar code in two parts of my app, xcode gives warning for one but not the other. From my understanding of the documentation, I think there shouldn't be a warning anyway.
// In one part of my code I have this
__block UploadOperation *uploadOperation = [[UploadOperation alloc] initWithPsc:self.persistentStoreCoordinator webService:self.webService];
uploadOperation.completionBlock = ^{
if (uploadOperation.uploadCount > 0) {
self.expediteNextSync = YES;
}
};
// And in another I have this
__block SyncOperation *syncOperation = [[SyncOperation alloc] initWithPsc:self.persistentStoreCoordinator webService:self.webService];
syncOperation.completionBlock = ^{
if (syncOperation.expediteNextSync) { // <--- This one gives the warning "Capturing 'syncOperation' strongly in this block is likely to lead to a retain cycle"
...
}
};
The documentation says:
In iOS 8 and later and macOS 10.10 and later, this property is set to nil after the completion block starts.
So I don't think there will be any save cycle.
+3
source to share
No one has answered this question yet
Check out similar questions: