GPS Icon Appears on App Launch Despite No CLLocationManager Usage – Need Help Tracing Cause

Hello everyone,

I’m facing an issue with my iOS app where the GPS/location services icon appears in the status bar immediately when the app is launched, even though I’m not intentionally accessing location services at that point.

Issue Summary:

•	GPS Icon Activation: When I launch my app, the GPS icon turns on. It turns off when the app is minimized or closed.
•	No Intentional Location Usage at Launch: I have ensured that no instances of CLLocationManager are created when the app is launched.

What I’ve Tried So Far:

1.	Checked Controllers and Related Classes:
•	Reviewed all the code for the controllers that are active at launch.
•	Verified that none of these controllers create instances of CLLocationManager or call location-related methods.
2.	Commented Out startUpdatingLocation:
•	Commented out all calls to startUpdatingLocation throughout the entire project.
3.	Ensured No CLLocationManager Instances at Launch:
•	Searched for any code that might instantiate CLLocationManager during app launch.
•	Confirmed that no such instances are being created.
4.	Commented Out Google Maps SDK Configuration:
•	In AppDelegate, commented out the Google Maps SDK configuration, so it’s not initialized with the API key.
•	No map views (GMSMapView, MKMapView) are initialized or used when the app is launched.
5.	Tested Location Permissions:
•	When I change the location permission for the app to “Never” in the Settings app, the GPS icon does not appear upon app launch.
•	This suggests that the app is accessing location services when it has permission, even though I haven’t explicitly requested it at launch.

Objective:

•	Control GPS Activation: I want to ensure that the GPS does not turn on when the app is launched. I intend to activate location services only when needed later in the app.

Request for Assistance:

I’m seeking guidance on the following:

1.	Debugging Techniques:
•	How can I trace the code that’s causing the GPS to turn on at app launch?
•	Are there tools or methods to identify hidden or indirect calls to location services?
2.	Forcing Location Services Off at Launch:
•	Is there a way to programmatically prevent location services from activating during app launch?
•	Can I defer any implicit location service initialization until I explicitly enable it?
3.	Potential Hidden Triggers:
•	Are there known scenarios where location services could be activated without direct use of CLLocationManager?
•	Could frameworks like Google Maps SDK trigger location services even if not fully initialized?
4.	Additional Suggestions:
•	Any other insights or suggestions to prevent the GPS icon from appearing on app launch.

Additional Information:

•	Third-Party Frameworks:
•	I have not removed third-party frameworks yet, as I wanted to check other possibilities first.
•	Open to the idea that a third-party framework might be causing this, but need guidance on how to confirm.
•	Code Availability:
•	I’m happy to provide specific code snippets if that would help diagnose the issue.

Environment: • Xcode Version: Xcode 15.4, Xcode 16.0 • iOS Deployment Target: iOS 15.0 • Devices Tested: iPhone SE 2nd and 3rd gen, iPhone 15, iPhone 15 pro, iPhone 11 • Programming Language: Swift

What I’m Looking For: • Assistance in tracing the cause of the GPS activation on app launch. • Suggestions on how to prevent location services from starting until explicitly needed. • Insights into any hidden triggers or indirect usages that might cause this behavior.

Thank you for your time and assistance. Any help to resolve this issue would be greatly appreciated.

The location icon will appear whenever any code in your app (whether code you wrote, or imported via a 3rd party library) receives location information.

A mapping SDK will definitely trigger this, so would any 3rd party library that may be collecting location information without explicitly specifying it. You will need to investigate any piece of code that is not yours to make sure they are not requesting location information.

There is no other way your app is triggering the location icon. Your app is receiving location data from the CoreLocation framework.

There is no programmatic way to prevent this - after all, it is considered all your code once the app is built. What you can do is to remove the location privacy strings from your Info.plist and have the location authorization made by the 3rd party libraries fail.

Outside of that, you will need to investigate the libraries you are using to see which one is indeed making location requests.

You can use otool command line tool to view the contents of your app or the libraries' binaries (man otool for help)

Or use the nm tool (man nm) to see the symbol table of the binaries.

These are not magic wands that will give you the answers you seek, and may need some further investigation into any libraries you use.


Argun Tekant /  DTS Engineer / Core Technologies

GPS Icon Appears on App Launch Despite No CLLocationManager Usage – Need Help Tracing Cause
 
 
Q