2
votes

I got my app rejected because

We found that your app uses a background mode but does not include functionality that requires that mode to run persistently. This behavior is not in compliance with the App Store Review Guidelines.

We noticed your app declares support for location in the UIBackgroundModes key in your Info.plist but does not include features that require persistent location.

I need to track the user location in the background in order to fire a notification if the user is near one of his/her pictures on the application. That's why I used background mode key on my .plist

This how I initialize my locationManager

_locationManager = [[CLLocationManager alloc] init];
_locationManager.delegate = self;
_locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
_locationManager.distanceFilter = 1000; // Will update evert 1 KM.
_locationManager.activityType = CLActivityTypeFitness;
_locationManager.pausesLocationUpdatesAutomatically = YES;
[_locationManager startUpdatingLocation];

And I'm using didUpdateToLocation to receive the location on the background.

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
    if (_currentLocation == nil){
        self.currentLocation = newLocation;
    }else{

        if([self.currentLocation distanceFromLocation:newLocation]){
            [self getNearPicturesMethod:newLocation];
        }
    }

}

They pointed to me that I should use "startMonitoringSignificantLocationChanges" but still if I remove the background key (what they want) the app won't receive location updates anymore if it's on the foreground, they present only if the user opens it and that doesn't work for me.

PS. I read related questions but nobody seemed to fix this problem or to provide a workaround.

1
How have you tested this? Your app should wake up for significant-change location updates without background mode but these kind of events can be unreliable on the simulator.gavdotnet
I could only create the behavior once in a real device, in the simulator never works; Any thoughts?David Castro
Perhaps you could post your code that starts and stops the significant change location monitoring? Also, in what sort of area will the app be used? Large city, smaller city or country-side? Wifi networks and cell tower density will affect the accuracy of non-GPS location services.gavdotnet
Also, (from significant change location docs): "Apps can expect a notification as soon as the device moves 500 meters or more from its previous notification. It should not expect notifications more frequently than once every five minutes. If the device is able to retrieve data from the network, the location manager is much more likely to deliver notifications in a timely manner." How far were you moving in your tests with the device? How long did you wait at each location?gavdotnet

1 Answers

0
votes

Your app will wake on significant location changes. You do not need the background location mode key set for that. Same goes for region boundary monitoring.

For your case, I think you will more likely want to set regions for the nearest pictures and then just wait for boundaries to be crossed.

Use significant location changes to update the nearest pictures and reset your regions to those.

This will work as intended, be within the guidelines of Apple docs and impact the battery of the user very little, if any.