Asked this on forum.qt.io, but with no help...can someone here offer any insight?
=========================================
When running my app on iOS 9 that collects the user's location (typically once per second) and the app is backgrounded, the OS kills the geolocation service. I have updated the info.plist to account for required background modes and the location services according to the Apple docs. But, processing still stops.

On iOS 6.1, however, this does not happen, processing continues when the app is backgrounded.

According to StackOverflow, we should be using this to enable background locations in iOS 9...but how do we do that with Qt?

Qt Code:
  1. if ([self.locationManager respondsToSelector:@selector(allowsBackgroundLocationUpdates:)]) {
  2. self.locationManager.allowsBackgroundLocationUpdates = YES;
  3. }
To copy to clipboard, switch view to plain text mode 

http://stackoverflow.com/questions/3...-in-background

SO, I am doing the following, which works in the iOS simulator (iOS 9, iPhone6), but not on the phone.

I call EnableIOSBackgroundLocation() in my main.cpp file. The return Boolean sets a QML Image to be visible (either a green GPS icon on success or a red one on failure).

In the simulator, the green GPS icon shows up...and the location continues to be logged when the app is put in the background. On a real iPhone running iOS 9, the green GPS icon shows up also, but the GPS is killed after a couple of minutes when the app is backgrounded.

Anyone have any ideas why?

iosLocation .mm:

Qt Code:
  1. #include "ioslocation.h"
  2.  
  3. #import <CoreLocation/CoreLocation.h>
  4.  
  5. bool IOSLocation::EnableIOSBackgroundLocation()
  6. {
  7. CLLocationManager *locationManager;
  8. locationManager = [[CLLocationManager alloc] init];
  9.  
  10. if ([locationManager respondsToSelector:@selector(allowsBackgroundLocationUpdates:)]) {
  11. locationManager.allowsBackgroundLocationUpdates = YES;
  12.  
  13. if ([locationManager respondsToSelector:@selector(pausesLocationUpdatesAutomatically:)]) {
  14. locationManager.pausesLocationUpdatesAutomatically = NO;
  15.  
  16. // Request location authorization
  17. [locationManager requestAlwaysAuthorization];
  18.  
  19. // Set an accuracy level. The higher, the better for energy.
  20. locationManager.desiredAccuracy = kCLLocationAccuracyBest;
  21.  
  22. // Specify the type of activity your app is currently performing
  23. locationManager.activityType = CLActivityTypeOtherNavigation;
  24.  
  25. // Set distance filter to NONE
  26. locationManager.distanceFilter = kCLDistanceFilterNone;
  27.  
  28. return true;
  29. } else {
  30. return false;
  31. }
  32. }
  33. return false;
  34. }
To copy to clipboard, switch view to plain text mode 

iosLocation .h:

Qt Code:
  1. #ifndef _iosLocation_h
  2. #define _iosLocation_h
  3.  
  4. class IOSLocation
  5. {
  6. public:
  7. static void EnableIOSBackgroundLocation();
  8. };
  9.  
  10. #endif
To copy to clipboard, switch view to plain text mode 

Anyone have any ideas on why this is happening? Ideas on how to get around it and make it work?

--Sam