React-native-permissions: [!] Unable to find a specification for `RNPermissions` depended upon by `Permission-LocationWhenInUse`

Created on 14 Oct 2019  ·  18Comments  ·  Source: zoontek/react-native-permissions

"react-native": "0.59.1"

When I execute pod install, it reports an error

 "[!] Unable to find a specification for "RNPermissions" depended upon by "Permission-LocationWhenInUse"

You have either:
 * out-of-date source repos which you can update with "pod repo update" or with "pod install --repo-update".
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile."

Then i try to command pod repo update and pod install --repo-update, it report

"[!] Unable to find a specification for "RNPermissions" depended upon by "Permission-LocationWhenInUse"

You have either:
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile."

The following is my "podfile"

platform :ios, '10.1'

target 'xxx' do
  permissions_path = '../node_modules/react-native-permissions/ios'

  pod 'Permission-LocationWhenInUse', :path => "# {permissions_path}/LocationWhenInUse.podspec"

  target 'xxxTests' do
    inherit! :search_paths
    permissions_path = '../node_modules/react-native-permissions/ios'

    pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
  end

end

cocoapods has been successfully installed.
I don't konw how can i do to solov it.

Most helpful comment

I was facing the same problem after adding,
pod 'RNPermissions', :path => '../node_modules/react-native-permissions', it fixed for me

All 18 comments

I was facing the same problem after adding,
pod 'RNPermissions', :path => '../node_modules/react-native-permissions', it fixed for me

@rutujayewalekar29 is right. react-native 0.59 does not support autolinking, so you'll need to install the core library with Cocoapods.

I was facing the same problem after adding,
pod 'RNPermissions', :path => '../node_modules/react-native-permissions', it fixed for me

Thank you @rutujayewalekar29 @zoontek ! i can run pod install corrected, but i have met a new problem when i execute react-native run-ios

error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening panther.xcworkspace

** BUILD FAILED **

The following commands produced analyzer issues:
    Analyze /xxx路径/node_modules/react-native/ReactCommon/jsi/jsi.cpp normal x86_64
    Analyze /xxx路径/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp normal x86_64
    Analyze /xxx路径/node_modules/react-native/React/Base/RCTModuleMethod.mm normal x86_64
    AnalyzeShallow /xxx路径/node_modules/react-native-fast-image/ios/Vendor/SDWebImage/Vendors/libwebp/src/enc/analysis_enc.c normal x86_64
    AnalyzeShallow /xxx路径/node_modules/react-native-fast-image/ios/Vendor/SDWebImage/Vendors/FLAnimatedImage/FLAnimatedImage/FLAnimatedImageView.m normal x86_64
    AnalyzeShallow /xxx路径/node_modules/react-native-fast-image/ios/Vendor/SDWebImage/Vendors/FLAnimatedImage/FLAnimatedImage/FLAnimatedImage.m normal x86_64
(6 commands with analyzer issues)

The following build commands failed:
    CompileC /xxx路径/ios/build/panther/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RNPermissions.build/Objects-normal/x86_64/RNPermissions.o /xxx路径/node_modules/react-native-permissions/ios/RNPermissions.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
. Run CLI with --verbose flag for more details.

The following is what I got after executing the pod install

Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There are 2 dependencies from the Podfile and 3 total pods installed.

[!] React has been deprecated

i try to delete build folder and re-install node-modules,but it still doesn't work.

@ppdbxdawj You must install React from your node_modules, not from the Cocoapods main repository (where it's an old version). Check the documentation for 0.59: https://facebook.github.io/react-native/docs/0.59/integration-with-existing-apps#configuring-cocoapods-dependencies. Don't forgot to unlink /Librairies installed via Cocoapods (right click, delete, but only remove references)

Also, clear build cache, check https://github.com/react-native-community/cli/issues/626

I believe I encountered a similar issue. I wonder how do you solve this? When I ran pod install, it couldn't find the spec for RNPermissions. I tried the workaround suggested by rutujayewalekar29 but I got a new problem, which is pods downloaded a new React insides its Pod folder, and since there are two React in my machine (the other one is the original React in node_modules used by the rest of the project), I cannot build the project anymore.

@annandherbell @rutujayewalekar29 did not suggest a workaround, but described the way to link install the lib with RN <= 0.59 🙂 I suppose you use this.

If you want to get rid of the React pod dependency, you can try adding

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "React"
      target.remove_from_project
    end
  end
end

at the absolute end of your Podfile, then run pod install and clean the project before building it again.

@rutujayewalekar29 is right. react-native 0.59 does not support autolinking, so you'll need to install the core library with Cocoapods.

Not 100% sure about this. My project is running 0.61 as well, I have "react-native-permissions": "^2.0.6" with me. While here's what in the podfile

 permissions_path = '../node_modules/react-native-permissions/ios'
   pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
   pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary.podspec"
   pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"

Yet, im getting the similar error as reported earlier.
``[!] Unable to find a specification forRNPermissionsdepended upon byPermission-PhotoLibrary````

🙁 am I missing something?

Update on how I'm doing it now:
I have this in my podfile, it builds now.

  pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
  pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary.podspec"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"

seeing this error – also after upgrading to React Native 0.63.4 + react-native-permissions 3.0.0
All above solution did not work for me
Any idea for someone?

@oferRounds You might forgot to read the migration guide / the release notes: https://github.com/zoontek/react-native-permissions/blob/master/MIGRATION.md#breaking-changes

@zoontek thanks! I have made the change. This is how my pods looks:

platform :ios, '12.0'
use_frameworks!

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

pre_install do |installer|
   installer.pod_targets.each do |pod|
     if pod.name.eql?('RNPermissions') || pod.name.start_with?('Permission-')
      def pod.build_type;
         Pod::BuildType.static_library
       end
     end

     if pod.name.start_with?('RNFB')
       def pod.build_type;
         Pod::BuildType.static_library
       end
     end
  end
end

target 'Bob' do

  pod 'SVProgressHUD', '~> 2.2.5'
  pod 'SwiftEntryKit', '1.2.3'

  permissions_path = '../node_modules/react-native-permissions/ios'

  pod 'Permission-BluetoothPeripheral', :path => "#{permissions_path}/BluetoothPeripheral"
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse"
  pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary"
  pod 'Permission-Motion', :path => "#{permissions_path}/Motion"
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary"

end

target 'OneSignalNotificationServiceExtension' do
  pod 'OneSignal', '>= 2.9.3', '< 3.0'
end

@oferRounds Did you trash the Xcode DerivedData?

Ok, found the issue. My pod file was missing the lines:

config = use_native_modules!

use_react_native!(:path => config["reactNativePath"])

They are not shown in the react-native-upgrade-tool – they were included only when I created a sample project from scratch

Anyhow, everything works great now!

@zoontek thanks for your help!!

Thanks, you’re right, I now see those lines. Perhaps I missed them some how...

@oferRounds I only ran over there really quickly to check, and re-checked my own project because it's so common right? And I wanted to make sure I personally hadn't missed it or that there wasn't a bug in upgrade-helper (it happens!). Glad you're moving along now, good luck with your project

Thank you very much @mikehardy! Appreciate it!

Open RNPermissions.podspec in node_modules/react-native-permissions replace s.dependency "React-Core" with s.dependency "React/Core".

https://github.com/facebook/react-native/issues/30018#issuecomment-716041423

@ericksondelacruz I don't think that advice is correct for all people. I think that advice is for people on old react-native versions.

You can clearly see the name of the Pod is "React-Core" now

https://github.com/facebook/react-native/blob/1fc1873c21a6d9c689d15101572dffd78caa3e04/React-Core.podspec#L38

And that file was added 2 years ago here - for RN0.61 I believe

https://github.com/facebook/react-native/pull/25619/files#diff-861bd4d2c6ddd2c1712990d9198602373a91dc7739f29345b12d4f50d8ba214b

And it is necessary for people to depend on it https://github.com/facebook/react-native/issues/29633#issuecomment-694187116

I think for people on current versions your advice will result in more problems. Build advice without version information can go wrong quickly

Was this page helpful?
0 / 5 - 0 ratings