zoontek / react-native-permissions

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

No podspec found for `Permission-Camera` in `../node_modules/react-native-permissions/ios/Camera.podspec` #812

Closed mumnanikunj closed 1 year ago

zoontek commented 1 year ago
# Remove .podspec at the end, see previous versions documentation: https://github.com/zoontek/react-native-permissions/tree/3.6.1#ios
permissions_path = '../node_modules/react-native-permissions/ios'

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

Consider a one time sponsoring for the free help here, it's 100% not an issue.

fahadJariwala commented 10 months ago

Found Same issue No podspec found for Permission-Camera in `../node_modules/react-native-permissions/ios/Camera

React Native: 0.73.0 react-native-permissions version : ^4.0.1

zoontek commented 10 months ago

@fahadJariwala Read the documentation / the v4 migration guide.

lossen commented 9 months ago

@fahadJariwala Read the documentation / the v4 migration guide.

Hello. I'm migrating project from react native 0.70.3 to 0.73.0 and I have the same issue. I do not have .podspec extension on podfile Tried with/without Workaround for use_frameworks! issues "react-native": "^0.73.0", "react-native-permissions": "4.1.1", cocoapods-1.15.2 node v18.12.1

My podfile


def node_require(script)
  # Resolve script with node to allow for hoisting
  require Pod::Executable.execute_command('node', ['-p',
    "require.resolve(
      '#{script}',
      {paths: [process.argv[1]]},
    )", __dir__]).strip
end

node_require('react-native/scripts/react_native_pods.rb')
node_require('react-native-permissions/scripts/setup.rb')

platform :ios, 17.2
prepare_react_native_project!

setup_permissions([
  'AppTrackingTransparency',
  'Notifications',
])

flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

  target 'sleepschoolnext' do
    config = use_native_modules!
    use_frameworks! :linkage => :static
    $RNFirebaseAsStaticFramework = true

# Convert all permission pods into static libraries
pre_install do |installer|
  Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}

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

    use_react_native!(
      :path => config[:reactNativePath],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    # :flipper_configuration => flipper_config,
      :app_path => "#{Pod::Config.instance.installation_root}/.."
    )

    pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
    permissions_path = '../node_modules/react-native-permissions/ios'

    pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"
    # pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency"

    pod 'GoogleSignIn', '~> 6.2.2'
    pod 'TrustKit', '1.6.5'
    pod 'Firebase', :modular_headers => true
    pod 'FirebaseCore', :modular_headers => true
    pod 'GoogleUtilities', :modular_headers => true

    post_install do |installer|
       # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
      react_native_post_install(
        installer, 
        config[:reactNativePath],
        :mac_catalyst_enabled => false)

      # installer.pods_project.targets.each do |target|
      #   target.build_configurations.each do |config|
      #     config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
      #   end
      # end
    end
end`

Any suggestions?
zoontek commented 9 months ago

@lossen Follow the README / the new setup guide.

lossen commented 9 months ago

@zoontek I've already followed README and setup guide. I've also checked issues, but it doesn't work for some reason.

lossen commented 9 months ago

Ok here is corrected version of podfile. Now it works!


def node_require(script)
  # Resolve script with node to allow for hoisting
  require Pod::Executable.execute_command('node', ['-p',
    "require.resolve(
      '#{script}',
      {paths: [process.argv[1]]},
    )", __dir__]).strip
end

node_require('react-native/scripts/react_native_pods.rb')
node_require('react-native-permissions/scripts/setup.rb')

platform :ios, 17.2
prepare_react_native_project!

setup_permissions([
  'AppTrackingTransparency',
  'Notifications',
])

flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

  target 'sleepschoolnext' do
    config = use_native_modules!
    use_frameworks! :linkage => :static
    $RNFirebaseAsStaticFramework = true

    use_react_native!(
      :path => config[:reactNativePath],
      :hermes_enabled => false,
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    # :flipper_configuration => flipper_config,
      :app_path => "#{Pod::Config.instance.installation_root}/.."
    )

    pod 'GoogleSignIn', '~> 6.2.2'
    pod 'TrustKit', '1.6.5'
    pod 'Firebase', :modular_headers => true
    pod 'FirebaseCore', :modular_headers => true
    pod 'GoogleUtilities', :modular_headers => true

    post_install do |installer|
       # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
      react_native_post_install(
        installer, 
        config[:reactNativePath],
        :mac_catalyst_enabled => false)

      # installer.pods_project.targets.each do |target|
      #   target.build_configurations.each do |config|
      #     config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
      #   end
      # end
    end
end`
tomtargosz commented 8 months ago

For anyone in the future coming to this issue- I was seeing this error when migrating from 3.x to 4.x. Turns out I still had these in my Podfile:

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

Once I removed those everything worked as expected 🙂

vaghasiya-mayur commented 1 month ago

Thank you @tomtargosz

For anyone in the future coming to this issue- I was seeing this error when migrating from 3.x to 4.x. Turns out I still had these in my Podfile:

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

Once I removed those everything worked as expected 🙂

Thank you @tomtargosz You save my life