Releasing instance if service not enabled?
Posted
by fuzzygoat
on Stack Overflow
See other posts from Stack Overflow
or by fuzzygoat
Published on 2010-05-19T12:46:02Z
Indexed on
2010/05/19
12:50 UTC
Read the original article
Hit count: 309
I would just like to check if I have this right, I am creating an instance of CCLocationManager
and then checking if location services are enabled. If it is not enabled I then report an error, release the instance and carry on, does that look/sound right?
locationManager = [[CLLocationManager alloc] init];
BOOL supportsService = [locationManager locationServicesEnabled];
if(supportsService) {
[locationManager setDelegate:self];
[locationManager setDistanceFilter:kCLDistanceFilterNone];
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
[locationManager startUpdatingLocation];
} else {
NSLog(@"Location services not enabled.");
[locationManager release];
}
...
...
... more code
cheers gary
© Stack Overflow or respective owner