Something that should work for both iOS 6 and 7 is to create a public method inside your class that conforms to the CLLocationManagerDelegate protocol, which tells itself to start monitoring the region. For instance:
//LocationManagerClass.h @interface LocationManagerClass : NSObject {... other stuff in the interface file} - (void)beginMonitoringRegion:(CLRegion *)region; @end
and then in
//LocationManagerClass.m @interface LocationManagerClass () <CLLocationManagerDelegate> @end @implementation LocationManagerClass {... other important stuff like locationManager:didEnterRegion:} - (void)beginMonitoringRegion:(CLRegion *)region { [[CLLocationManager sharedManager] startMonitoringForRegion:region]; } @end
So, in your case, you would call [appDelegate beginMonitoringRegion:region];
On the other hand, I would recommend NOT to enter the location control code in the application delegate. Although technically this will work, it is usually not a good design for such things. Instead, as in the example above, I would try to put it in my own location manager class, which is likely to be a single. This blog post gives some good support, so why donβt you put a ton of things into the appβs delegate: http://www.hollance.com/2012/02/dont-abuse-the-app-delegate/
source share