React Native移除iOS的蓝牙权限警报

问题描述

我没有在我的应用程序代码中请求蓝牙权限,但在应用程序加载时要求在iOS中发出权限警报。

我在代码中找不到任何引用,因此我遵循了此建议的所有解决方案:link,但没有用

我还在NSBluetoothAlwaysUsageDescription的info.plist中添加了以下目的字符串,但苹果拒绝了该应用程序。

“我们的应用程序不请求此权限或不使用此功能,但是它包含在我们的info.plist中,因为我们的应用程序使用react-native-permissions库,该库在其代码中引用了此权限。”

如果有人遇到相同的问题并且能够解决此问题,请提供帮助。谢谢

这是pod文件

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

def add_flipper_pods!(versions = {})
  versions['Flipper'] ||= '~> 0.33.1'
  versions['DoubleConversion'] ||= '1.1.7'
  versions['Flipper-Folly'] ||= '~> 2.1'
  versions['Flipper-Glog'] ||= '0.3.6'
  versions['Flipper-PeerTalk'] ||= '~> 0.0.4'
  versions['Flipper-RSocket'] ||= '~> 1.0'

  pod 'FlipperKit',versions['Flipper'],:configuration => 'Debug'
  pod 'FlipperKit/FlipperKitLayoutPlugin',:configuration => 'Debug'
  pod 'FlipperKit/SKIOSNetworkPlugin',:configuration => 'Debug'
  pod 'FlipperKit/FlipperKitUserDefaultsPlugin',:configuration => 'Debug'
  pod 'FlipperKit/FlipperKitReactPlugin',:configuration => 'Debug'

  # List all transitive dependencies for FlipperKit pods
  # to avoid them being linked in Release builds
  pod 'Flipper',:configuration => 'Debug'
  pod 'Flipper-DoubleConversion',versions['DoubleConversion'],:configuration => 'Debug'
  pod 'Flipper-Folly',versions['Flipper-Folly'],:configuration => 'Debug'
  pod 'Flipper-Glog',versions['Flipper-Glog'],:configuration => 'Debug'
  pod 'Flipper-PeerTalk',versions['Flipper-PeerTalk'],:configuration => 'Debug'
  pod 'Flipper-RSocket',versions['Flipper-RSocket'],:configuration => 'Debug'
  pod 'FlipperKit/Core',:configuration => 'Debug'
  pod 'FlipperKit/CppBridge',:configuration => 'Debug'
  pod 'FlipperKit/FBCxxFollyDynamicConvert',:configuration => 'Debug'
  pod 'FlipperKit/FBDefines',:configuration => 'Debug'
  pod 'FlipperKit/FKPortForwarding',:configuration => 'Debug'
  pod 'FlipperKit/FlipperKitHighlightOverlay',:configuration => 'Debug'
  pod 'FlipperKit/FlipperKitLayoutTextSearchable',:configuration => 'Debug'
  pod 'FlipperKit/FlipperKitNetworkPlugin',:configuration => 'Debug'
end

# Post Install processing for Flipper
def flipper_post_install(installer)
  installer.pods_project.targets.each do |target|
    if target.name == 'YogaKit'
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '4.1'
      end
    end
  end
end

target 'Urent' do

  # React Native
  rn_path = '../node_modules/react-native'
  rn_maps_path = '../node_modules/react-native-maps'

  # Pods for Urent
  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/'

  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/callinvoker',: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',:modular_headers => true

  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 'react-native-geolocation',path: '../node_modules/@react-native-community/geolocation'


  pod 'Firebase','~> 6.24.0'
  pod 'Firebase/Core','~> 6.24.0'
  pod 'Firebase/Messaging','~> 6.24.0'

  pod 'GoogleMaps','3.5.0'
  pod 'Google-Maps-iOS-Utils','2.1.0'
  pod 'GoogleUtilities','6.6.0'
  pod 'GoogleAppMeasurement','6.5.0'


  pod 'react-native-google-maps',path: rn_maps_path # <~~ if you need GoogleMaps support on iOS


  pod 'RNVectorIcons',:path => '../node_modules/react-native-vector-icons'

  target 'UrentTests' do
    inherit! :complete
    # Pods for testing
  end

  use_native_modules!

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled,Flipper will not work and
  # you should disable these next few lines.
  add_flipper_pods!
  post_install do |installer|
    flipper_post_install(installer)
    installer.pods_project.targets.each do |target|
      if target.name == 'react-native-google-maps'
        target.build_configurations.each do |config|
          config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
        end
      end
      if target.name == "React"
        target.remove_from_project
      end
    end
  end
end

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

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

解决方法

非常感谢,我能够解决此问题,并成功删除了Bluetooth权限警报。在我的情况下,问题出在“ react-native-connectivity-status”库中。我将该库从版本“ 1.5.2”降级为“ 1.5.1”。 步骤如下:

更改

"react-native-connectivity-status": "^1.5.1",

收件人

"react-native-connectivity-status": "1.5.1",

然后运行以下命令:

rm -rf node_modules/
rm package-lock.json
npm i
cd ios/
rm -rf Pods/
pod install