Skip to content

Conversation

@CoryWritesCode
Copy link

Fixes #67

@douglasjunior
Copy link
Owner

douglasjunior commented Nov 4, 2025

Thank you for the PR!

I have a question, following the example in #67 both the promises are resolved or rejected?

What you see in console if you do:

GetLocation.getCurrentPosition({
      ....
    })
      .then(newLocation => {
        console.log('resolved 1', newLocation);
      })
      .catch(ex => {
        console.log('rejected 1', ex);
      });
      
GetLocation.getCurrentPosition({
      ....
    })
      .then(newLocation => {
        console.log('resolved 2', newLocation);
      })
      .catch(ex => {
        console.log('rejected 2', ex);
      });

The expected behavior is that the first one rejects to a "CANCELLED" error and the second resolves to location.

@CoryWritesCode
Copy link
Author

Without this code, in the example in #67 this is what happens if I add the logs like you mentioned.
image

@douglasjunior
Copy link
Owner

In my example I assume that the permission was accepted ou rejected permanently, if the execution flow is stopped by the permission dialog, then the order of the events can change.

Please try again with and without your fix.

@CoryWritesCode
Copy link
Author

CoryWritesCode commented Nov 4, 2025

What's seen above is without the fix.

With my fix the console logs are the same, I just don't get a crash after attempting a second getLocation() request
image

@CoryWritesCode
Copy link
Author

The xcode logs are:

With Fix:
image

Without Fix:
image

@CoryWritesCode
Copy link
Author

Sorry for that extra commit. Had to many terminals open at once

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iOS Crash when permissions are denied and the current position is requested back to back

2 participants