I debugged all day, and the delegate was generally called.
- (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region
Well here is my standard code calling the monitor. use CoreLocation.framework.
[locationManager startMonitoringForRegion:geofence]
And registered them in my plist.
<key>NSLocationAlwaysUsageDescription</key>
<string>Lugang</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Lugang</string>
Updating the background application in resolution, but I did not see my application inside.
I tried to print my controlled Regions in the LocationManager example, and there is my controlled area.
NSLog(@"%@" ,locationManager.monitoredRegions);
and regionMonitoringAvailable is true.
NSLog(@"%d" , [CLLocationManager regionMonitoringAvailable] );
In iOS 8, I asked for requestAlwaysAuthorization
[locationManager requestAlwaysAuthorization]
I tried three states, the application is in the foreground, the application is in the background, the application is inactive. none of these conditions were caused.
-(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
there were no errors.
And I tried
[locationManager requestStateForRegion:geofence]
works great.
- (void)locationManager:(CLLocationManager *)manager didDetermineState:(CLRegionState)state forRegion:(CLRegion *)region
activated in my requestStateForRegion.
, , didEnterRegion , , iOS 7 , , .
, requestStateForRegion , , DidEnterRegion . , .