AppleSimulatorUtils icon indicating copy to clipboard operation
AppleSimulatorUtils copied to clipboard

iOS Simulator location fails after changing its permissions with applesimutils (React Native geolocation)

Open jpbarbosa opened this issue 4 years ago • 2 comments

Description In an application built with React Native, geolocation fails on iOS Simulator after changing its permissions with applesimutils (accepting location permissions manually works as expected). It's necessary to change iOS Simulator location manually and restart the app to get it back to work (iOS Simulador > Features > Location).

Steps to Reproduce

  • Create a simple React Native app with an geolocation library (e.g.: https://github.com/Agontuk/react-native-geolocation-service)
  • Run applesimutils --byName "iPhone 12" --bundle <BUNDLE_ID> --setPermissions "location=inuse"
  • Open the app on iOS Simulator following the standard React Native process (yarn start, npx react-native run-ios --simulator "iPhone 12")
  • Geolocation will return error code 2 / Unable to retrieve location.

Expected Behavior Geolocation should work without needing to accept location permission prompt.

Environment

  • macOS: 10.15.7 (Catalina) and 11.3.1 (Big Sur)
  • Xcode: 12.4 and 12.5
  • applesimutils: 0.9.4
  • react-native: 0.61.0
  • react-native-geolocation-service: 5.3.0

jpbarbosa avatar Jul 28 '21 17:07 jpbarbosa

Seeing the same problem on iOS 15.4 simulators. There is a PR in https://github.com/michalchudziak/react-native-geolocation/pull/180 that fixes mock locations on iOS 15, could it be the same bug?

ywongweb avatar Jun 19 '22 18:06 ywongweb

Hey @jpbarbosa, @ywongweb are you still experiencing this issue? have you tried to use setLocation with applesimutils? I suspect that there's an issue with the Simulator app so you might need to call setLocation twice after setting a new permissions.. (with the same values)

asafkorem avatar Jul 11 '22 06:07 asafkorem

location option under --setPermissions command is now deprecated in favor of its overlapping feature in Simctl, please migrate to xcrun simctl privacy from the latest Command Line Tools for Xcode.

Check our deprecation update for more details: https://github.com/wix/AppleSimulatorUtils/blob/master/DEPRECATIONS.md

asafkorem avatar Jan 15 '24 09:01 asafkorem