-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nil unsafe delegates and data sources at dealloc #2
Conversation
This isn't a comprehensive review. There are probably some I missed. System objects with unsafe references to their delegates may outlive the lifetime of their delegates (eg when animating), sending messages to deallocated instances. To be safe, if you assign your object as a delegate to an unsafe delegate you also need to manually manage that unsafe reference and prevent it from outliving your object.
@@ -126,6 +127,7 @@ - (void)startTracking | |||
if ([CLLocationManager locationServicesEnabled] == YES) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- (void)startTracking
{
if ([CLLocationManager locationServicesEnabled] == YES)
{
APCLogDebug(@"Start location tracking");-
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = nil;
self.locationManager.delegate = self;
-
just curious why you're allocating a whole new CLLocationManager every time you start and stop tracking, rather than creating it once and then starting/stopping SignificantLocationChanges as needed...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That'd be a valid approach as well. Easy to just check if self.locationManager isn't nil if you wanted to do it that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raised #7 for doing this in future.
Reviewed by Erin, merged. |
Updates from shipping apps
Refactor valueString methods
…en_eligible_to_email_verification Add Share This App option in verify email
This isn't a comprehensive review. There are probably some I missed.
System objects with unsafe references to their delegates may outlive the
lifetime of their delegates (eg when animating), sending messages to
deallocated instances. To be safe, if you assign your object as a delegate
to an unsafe delegate you also need to manually manage that unsafe
reference and prevent it from outliving your object.