Search code examples
iosflash-builder

ios 11 no GPS request


Had a geolocation request working fine for my iPhone, now that I've update to ios 11 it no longer pops up the prompt to allow access to GPS position.

if (Geolocation.permissionStatus == "unknown" && Geolocation.isSupported == true){
        GPS.addEventListener(PermissionEvent.PERMISSION_STATUS, gpsPermission);
        GPS.requestPermission();

After research apparently I might need to include something in xml to allow permission for iPhone. If I go into settings and enable GPS in there the app runs the GPS fine, it is only the permission request that doesn't work.

I also no longer get my app icon showing in the menu after updating.

Thanks


Solution

  • Okay, so before ios 11 I didn't need to add any keys for iphone, but in ios 11 you do.

            <key>NSLocationAlwaysUsageDescription</key> 
            <string>Sample description to allow geolocation always</string> 
            <key>NSLocationWhenInUseUsageDescription</key> 
            <string>Sample description to allow geolocation when application is in foreground</string> 
    

    I had tried these, but they didn't make the request pop up. What I needed was this:

            <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
            <string>Sample description to allow geolocation always and when application is in foreground</string>
    

    No ideas why but this fixed the problem. If someone would care to elaborate I'd appreciate it. Maybe iPhone just wanted the user to be able make there own choice.

    Thanks for your time