I am trying to learn AVFoundation sample code "AVCam". In the sample code project, AVCamViewController.m class, there is an implementation like
__weak AVCamViewController *weakSelf = self;
[self setRuntimeErrorHandlingObserver:[[NSNotificationCenter defaultCenter] addObserverForName:AVCaptureSessionRuntimeErrorNotification
object:[self session]
queue:nil
usingBlock:^(NSNotification *note) {
AVCamViewController *strongSelf = weakSelf;
My question is why we want to first declare a __weak pointer, and later on assign this weak pointer to *strongSelf. What would be the difference that if we assign "self" directly
Something like:
AVCamViewController *strongSelf = self