React-native-permissions: iOS "use_frameworks!" conflict problem with Mapbox

Created on 8 Feb 2020  路  13Comments  路  Source: zoontek/react-native-permissions

Question

in Mapbox documents says that we should set use_frameworks! enabled
but in react-native permissions documents says that we shouldn't use it
and also when i use 3rd way:
replace it by use_modular_headers!

and 4th way:
```use_frameworks!

$dynamic_frameworks = ['RxCocoa', 'RxSwift', 'WhatEverSDKName']

pre_install do |installer|
installer.pod_targets.each do |pod|
if !$dynamic_frameworks.include?(pod.name)
puts "Overriding the static_framework? method for #{pod.name}"
def pod.build_type;
Pod::Target::BuildType.static_library
end
end
end
end
```

it doesn't fix and show this error:

Invalid RNPermission 'ios.permission.LOCATION_WHEN_IN_USE'. should be one of: (
)

what should I do to fix this problem??

question

Most helpful comment

@amirito Thanks! I made a merge request so you understand how to do it.

All 13 comments

@amirito In complex cases, you can still use this workaround: https://github.com/react-native-community/react-native-permissions/issues/348#issuecomment-541423154

@zoontek still not working
is it necessary any changes in podfile?

this is my podfile:

platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'PROJECT_NAME' do
  # Pods for PROJECT_NAME
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'


  # Permissions
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-BluetoothPeripheral', :path => "#{permissions_path}/BluetoothPeripheral.podspec"
  pod 'Permission-Calendars', :path => "#{permissions_path}/Calendars.podspec"
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
  pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts.podspec"
  pod 'Permission-FaceID', :path => "#{permissions_path}/FaceID.podspec"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
  pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary.podspec"
  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone.podspec"
  pod 'Permission-Motion', :path => "#{permissions_path}/Motion.podspec"
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications.podspec"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"
  pod 'Permission-Reminders', :path => "#{permissions_path}/Reminders.podspec"
  pod 'Permission-Siri', :path => "#{permissions_path}/Siri.podspec"
  pod 'Permission-SpeechRecognition', :path => "#{permissions_path}/SpeechRecognition.podspec"
  pod 'Permission-StoreKit', :path => "#{permissions_path}/StoreKit.podspec"


  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'
  pod 'RNFirebase/Crashlytics', :path => '../node_modules/react-native-firebase/ios'
  pod 'Firebase/Messaging', '~> 6.15.0'
  pod 'GoogleIDFASupport', '~> 3.14.0'

  # Mapbox
  pod 'react-native-mapbox-gl', :path => '../node_modules/@react-native-mapbox-gl/maps'


  target 'PROJECT_NAMETests' do
    inherit! :search_paths
    # Pods for testing
  end

  use_frameworks!
  use_native_modules!
end

target 'PROJECT_NAME-tvOS' do
  # Pods for PROJECT_NAME-tvOS

  target 'PROJECT_NAME-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

@amirito Remove all permissions handlers from your Podspec (only link the core), drag and drop the handler files in your project, don't copy them, only keep a reference.

# Permissions
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-BluetoothPeripheral', :path => "#{permissions_path}/BluetoothPeripheral.podspec"
  pod 'Permission-Calendars', :path => "#{permissions_path}/Calendars.podspec"
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"
  pod 'Permission-Contacts', :path => "#{permissions_path}/Contacts.podspec"
  pod 'Permission-FaceID', :path => "#{permissions_path}/FaceID.podspec"
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec"
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"
  pod 'Permission-MediaLibrary', :path => "#{permissions_path}/MediaLibrary.podspec"
  pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone.podspec"
  pod 'Permission-Motion', :path => "#{permissions_path}/Motion.podspec"
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications.podspec"
  pod 'Permission-PhotoLibrary', :path => "#{permissions_path}/PhotoLibrary.podspec"
  pod 'Permission-Reminders', :path => "#{permissions_path}/Reminders.podspec"
  pod 'Permission-Siri', :path => "#{permissions_path}/Siri.podspec"
  pod 'Permission-SpeechRecognition', :path => "#{permissions_path}/SpeechRecognition.podspec"
  pod 'Permission-StoreKit', :path => "#{permissions_path}/StoreKit.podspec"

@zoontek
Ok I removed all permissions and add pod 'RNPermissions', :path => '../node_modules/react-native-permissions' to my podfile
and added handlers to Permissions as you mentioned in your comment
but still has the error

@amarino If you setup everything well, it might be related to the Xcode build cache. Try to clean it.

@zoontek
no, I cleaned build
even I used npx react-native-clean-project --remove-iOS-build --remove-iOS-pods
but still not works

@amirito Could you provides a small repo with minimal amount of code to reproduce the issue so I could check what's missing?

@zoontek I created a repo in gitlab and added you there
and thank you for your help

@amirito Thanks! I made a merge request so you understand how to do it.

Guys, could you share the solution, please? I meet the same issue in mostly the same situation...

@zoontek really thank you for your help and I appreciate it

@igor-bv
I forgot to add RNPermission.h and RNPermission.m to the group that i've made (Permissions) and also should add a config file named react-native.config.js

module.exports = {
    dependencies: {
        "react-native-permissions": {
            platforms: { ios: null }
        }
    }
};

@amirito, thanks a lot for quick response!

Was this page helpful?
0 / 5 - 0 ratings