zoontek / react-native-permissions

An unified permissions API for React Native on iOS, Android and Windows.
MIT License
4.04k stars 828 forks source link

'new' is unavailable 'init' has been explicitly marked unavailable here #590

Closed manielli closed 3 years ago

manielli commented 3 years ago

Bug report

Summary

Xcode build fails (even after cleaning build folder).

After installing Xcode 12.5 and Command Line Tools 12.5, Xcode builds fails. The error is under Permission-BluetoothPeripheral Group, ~/node_modules/react-native-permissions/ios/BluetoothPeripheral/RNPermissionHandlerBluetoothPeripheral.m and says: 'new' is unavailable It also points to CBManager.h saying: 'init' has been explicitly marked unavailable here.

Environment info

react-native info output:

System:
    OS: macOS 11.2.3
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Memory: 1.72 GB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 12.22.0 - ~/.nvm/versions/node/v12.22.0/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.11 - ~/.nvm/versions/node/v12.22.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
    Android SDK:
      API Levels: 29, 30
      Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.3
      System Images: android-29 | Intel x86 Atom, android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom_64, android-30 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.7042882
    Xcode: 12.5/12E262 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_282 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.3 => 0.63.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Library version: 3.0.1 and 3.0.2

Steps to reproduce

  1. The usual steps to add the library according to documentation.
  2. A Clean build fails.

Describe what you expected to happen:

  1. Build not to fail. Screen Shot 2021-04-26 at 7 59 08 PM

Reproducible sample code

mikehardy commented 3 years ago

I'm about 2GB into downloading the 11GB package, I'll see if I can reproduce but won't have news until tomorrow.

phatlaunchdeck commented 3 years ago

Same problem for me here, and it's launch day lol

zoontek commented 3 years ago

Same as @mikehardy, I need to update. This will be a long day πŸ˜…

Screenshot 2021-04-27 at 10 05 23
mikehardy commented 3 years ago

I needed approx 40GB free before it would update but I'm updated on Xcode now and finishing the macOS 11.3 update then I can reproduce.

FWIW, though the general expectation of all iOS devs is "Use the current stable Xcode", attempting to do so on the actual first day it is out is asking for pain. New minor versions of Xcode always break something. Every single time. And it takes a couple days to sort out.

I use an OSX-KVM in order to sort this sort of thing out as a canary without blowing up my main development rigs (that keep the last minor version until my OSX-KVM is buliding and running things well).

zoontek commented 3 years ago

The fix is published: https://github.com/zoontek/react-native-permissions/releases/tag/3.0.3, please update πŸ™‚

eschos24 commented 3 years ago

We are experiencing this issue but are still on RN version 0.60.5. Is there a workaround for us to get this working without having to update to RN 0.63+?

mikehardy commented 3 years ago

With apologies, RN0.60 is no longer a viable development platform as of the release of iOS 14.5 - you must update to at least RN0.63

Why?

ergo, you must update to at least 0.63.3 to continue releasing iOS apps, so might as well get it done: https://react-native-community.github.io/upgrade-helper/

The repos I maintain are in the process of noting react-native 0.63 is the minimum required react-native version and we're dropping support / no longer testing against releases prior, FWIW

hzburki commented 3 years ago

Summary

Note: I had to install react-native-permissions@3.0.3 with npm i react-native-permissions@3.0.3 --legacy-peer-deps command. I ran into the dependency tree issue explained in #579.

Steps Taken

Environment Info

react-native info output

System:
    OS: macOS 11.3.1
    CPU: (8) x64 Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
    Memory: 169.20 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 12.21.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 7.6.2 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
    Android SDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.6953283
    Xcode: 12.5/12E262 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.2 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.3 => 0.63.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
mikehardy commented 3 years ago

This was an Xcode 12.5 issue, definitely fixed. Perhaps npx react-native-clean-project (it's a super deep cleaning depending on how you use it...)

hzburki commented 3 years ago

Upgrading RN to 0.63.3 and the package to 3.0.3 fixed the issue for me however, it did bring a lot of other issues (not related to this package) that I couldn't fix due to short deadlines. So for anyone who wants a quick fix, follow this article which shows how to use package-patch to make quick fixes to the node_modules folder.

The changes to the react-native-permissions node_modules are mentioned here

I got XCode 12.5 to build my app with react-native-permissions version 2.2.2

bogdandevlpr commented 3 years ago

Simply downgrading Xcode from 12.5 to 12.4 fixed it for me. I'm using react-native@0.62.2 and react-native-permissions@2.2.2