馃拪 Capacitor Doctor 馃拪
Latest Dependencies:
@capacitor/cli: 2.4.2
@capacitor/core: 2.4.2
@capacitor/android: 2.4.2
@capacitor/electron: 2.4.2
@capacitor/ios: 2.4.2
Installed Dependencies:
@capacitor/android not installed
@capacitor/cli 2.4.2
@capacitor/core 2.4.2
@capacitor/ios 2.4.2
@capacitor/electron not installed
Found 0 Capacitor plugins for ios:
[success] iOS looking great! 馃憣
iOS 14.2
Calling the getCurrentPosition API results in failure during the permission check on iOS 14.2 only. Seemingly the call times out after 2 seconds of waiting on the permission dialog. Console Output from XCode via emulator:
To Native -> Geolocation getCurrentPosition 80463459
APP INACTIVE
ERROR MESSAGE: {"message":"The operation couldn鈥檛 be completed. (kCLErrorDomain error 1.)","errorMessage":"The operation couldn鈥檛 be completed. (kCLErrorDomain error 1.)"}
鈿★笍 [error] - ERROR Error: Uncaught (in promise): Error: The operation couldn鈥檛 be completed. (kCLErrorDomain error 1.)

getCurrentPosition should wait until an option has been selected on the permission dialog.
Basic reproduction. Simply hit the 'test' button on tab 1 and you will see the above error in the xcode console.
https://github.com/abarax/capacitor-bug
Only Code added is here:
To run:
npm run build
npx cap sync
npx cap open ios
Run via XCode using iOS 14.2 simulator
@abarax Have you made any progress on this issue? I am getting the same error.
@zsyphon Right now our workaround is to sit in a loop checking permissions using the query permission API (https://capacitorjs.com/docs/apis/permissions) Once the permission is recognised, only then do we use getCurrentPosition.
I would love to dig in and figure out the cause here, I suspect something changed in the iOS operating system update. I actually think this was not happening on 14.2 beta as well, which is interesting.
Looks like jcesarmobile has a fix though!
It was happening on iOS 13 too, just took a bit longer to timeout. My PR should fix the problem.
@jcesarmobile Thank you!!
@zsyphon Right now our workaround is to sit in a loop checking permissions using the query permission API (https://capacitorjs.com/docs/apis/permissions) Once the permission is recognised, only then do we use getCurrentPosition.
I would love to dig in and figure out the cause here, I suspect something changed in the iOS operating system update. I actually think this was not happening on 14.2 beta as well, which is interesting.
@abarax @jcesarmobile Thank you!!
Having the same issue..
@zsyphon Right now our workaround is to sit in a loop checking permissions using the query permission API (https://capacitorjs.com/docs/apis/permissions) Once the permission is recognised, only then do we use getCurrentPosition.
I would love to dig in and figure out the cause here, I suspect something changed in the iOS operating system update. I actually think this was not happening on 14.2 beta as well, which is interesting.
@abarax have you used this approach on ios as well? I'm getting this log:
鈿★笍 [log] - This browser does not support the Permissions API
2.4.3 is out with this fix.
Most helpful comment
@zsyphon Right now our workaround is to sit in a loop checking permissions using the query permission API (https://capacitorjs.com/docs/apis/permissions) Once the permission is recognised, only then do we use getCurrentPosition.
I would love to dig in and figure out the cause here, I suspect something changed in the iOS operating system update. I actually think this was not happening on 14.2 beta as well, which is interesting.