【问题标题】:React Native Remove Bluetooth Permission Alert for iOSReact Native 删除 iOS 的蓝牙权限警报
【发布时间】:2021-02-11 01:17:36
【问题描述】:

我没有在我的应用代码中请求蓝牙权限,但它在应用加载时请求 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', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/SKIOSNetworkPlugin', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitUserDefaultsPlugin', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitReactPlugin', versions['Flipper'], :configuration => 'Debug'

  # List all transitive dependencies for FlipperKit pods
  # to avoid them being linked in Release builds
  pod 'Flipper', versions['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', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/CppBridge', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FBCxxFollyDynamicConvert', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FBDefines', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FKPortForwarding', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitHighlightOverlay', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitLayoutTextSearchable', versions['Flipper'], :configuration => 'Debug'
  pod 'FlipperKit/FlipperKitNetworkPlugin', versions['Flipper'], :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

【问题讨论】:

  • 您需要检查您正在使用的模块。常见的罪魁祸首是广告框架和媒体播放框架。
  • @Paulw11,这就是问题所在,我怎么知道哪个模块正在使用蓝牙?我试图搜索 node_modules 和 cocapods 但没有找到任何东西。
  • 您可以检查这些模块的来源,也可以一次删除一个可能的候选模块
  • @Paulw11 谢谢,但删除库和检查非常耗时。只有在没有的情况下我才能做到这一点。解决此问题的其他快速方法。
  • 我建议你先看看可能的罪魁祸首;你有任何广告框架吗? AV/媒体框架?任何 Facebook 框架?没有更多信息,我不能告诉你其他任何事情。您是不是错误地链接到了蓝牙框架?

标签: ios xcode react-native bluetooth core-bluetooth


【解决方案1】:

谢天谢地,我能够解决问题并成功删除蓝牙权限警报。就我而言,问题出在库“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

【讨论】:

    猜你喜欢
    • 2015-04-11
    • 2020-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多