Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XCode showing warning [CoreLocation] This method can cause UI unresponsiveness if invoked on the main thread. #784

Closed
karel-suchomel-ed opened this issue Jun 23, 2023 · 5 comments
Assignees

Comments

@karel-suchomel-ed
Copy link

Bug summary

I am using location permissions in my app and noticed XCode showing this warning:
"This method can cause UI unresponsiveness if invoked on the main thread. Instead, consider waiting for the -locationManagerDidChangeAuthorization: callback and checking authorizationStatus first."
image
image

I haven't personally experienced any issues, nor have the current users, but it is worth investigating

Library version

3.8.0

Environment info

System:
  OS: macOS 13.2
  CPU: (8) arm64 Apple M1
  Memory: 165.56 MB / 8.00 GB
  Shell:
    version: 5.8.1
    path: /bin/zsh
Binaries:
  Node:
    version: 20.3.0
    path: /opt/homebrew/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 9.6.7
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2023.06.08.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.12.1
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 22.2
      - iOS 16.2
      - macOS 13.1
      - tvOS 16.1
      - watchOS 9.1
  Android SDK:
    API Levels:
      - "29"
      - "30"
      - "31"
      - "32"
      - "33"
      - "34"
    Build Tools:
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 31.0.0
      - 33.0.0
    System Images:
      - android-29 | Intel x86 Atom
      - android-30 | Google APIs Intel x86 Atom
      - android-30 | Google Play ARM 64 v8a
      - android-31 | Google APIs ARM 64 v8a
      - android-31 | Google APIs Intel x86 Atom_64
    Android NDK: 22.1.7171670
IDEs:
  Android Studio: 2022.1 AI-221.6008.13.2211.9514443
  Xcode:
    version: 14.2/14C18
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: javac 20
    path: /usr/bin/javac
  Ruby:
    version: 3.2.2
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.0
    wanted: 0.72.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Steps to reproduce

  1. init RN project
  2. install and setup this library
  3. add Permission-LocationWhenInUse pod
  4. run the project and check XCode warnings

Reproducible sample code

A plain React Native init project is enough for this to occur
@karel-suchomel-ed karel-suchomel-ed added the bug Something isn't working label Jun 23, 2023
@zoontek
Copy link
Owner

zoontek commented Jun 23, 2023

@karel-suchomel-ed I already noticed this, and as you mention it's a false positive 🙂

@zoontek zoontek closed this as completed Jun 23, 2023
@zoontek zoontek removed the bug Something isn't working label Jun 23, 2023
@iArchin
Copy link

iArchin commented Oct 4, 2023

@zoontek I also have this exact issue and one of my screens becomes completely blank and "unresponsive" and I should mention that I have this problem in iOS 17. all good for older versions.

Library version

3.9.2

Environment info

System:
    OS: macOS 14.0
    CPU: (16) x64 Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz
    Memory: 1.96 GB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.14.0 - ~/.nvm/versions/node/v16.14.0/bin/node
    Yarn: 3.3.0 - /usr/local/bin/yarn
    npm: 8.3.1 - ~/.nvm/versions/node/v16.14.0/bin/npm
    Watchman: 2023.09.25.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.13.0 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.12 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: 0.71.13 => 0.71.13 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

@zoontek
Copy link
Owner

zoontek commented Oct 4, 2023

@iArchin Could you try v4: #808? (mostly because of a85e23d)

@zoontek
Copy link
Owner

zoontek commented Oct 4, 2023

@iArchin Just shipped 3.9.3 and 4.0.0 alpha 3 to fix it.

@iArchin
Copy link

iArchin commented Oct 4, 2023

@zoontek I can confirm that after upgrading to the version 3.9.3 issue is resolved. ty.

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

No branches or pull requests

3 participants