简体   繁体   English

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

[英]React Native Remove Bluetooth Permission Alert for iOS

I am not requesting bluetooth permission in my app code but it's asking for permission alert in iOS when the app loads.我不是在我的应用程序代码中请求蓝牙权限,而是在应用程序加载时在 iOS 中请求权限警报。

I couldn't find any reference in my code and I followed all the solutions suggested in this: link but it didn't work我在我的代码中找不到任何参考,我遵循了这里建议的所有解决方案: 链接但它不起作用

I also added the below purpose string into info.plist for NSBluetoothAlwaysUsageDescription but apple rejected the app.我还在 info.plist 中为 NSBluetoothAlwaysUsageDescription 添加了以下目的字符串,但苹果拒绝了该应用程序。

"Our app does not request this permission or utilize this functionality but it is included in our info.plist since our app utilizes the react-native-permissions library, which references this permission in its code." “我们的应用程序不会请求此权限或使用此功能,但它包含在我们的 info.plist 中,因为我们的应用程序使用了 react-native-permissions 库,该库在其代码中引用了此权限。”

If anyone had same issue and was able to resolve this, please help.如果有人遇到同样的问题并且能够解决此问题,请提供帮助。 Thanks谢谢

Here is the pod file:这是 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

Thankfully, I was able to resolve the issue and successfully removed the Bluetooth permission alert.谢天谢地,我能够解决问题并成功删除蓝牙权限警报。 In my case the problem was with the library "react-native-connectivity-status".就我而言,问题出在库“react-native-connectivity-status”上。 I downgraded the library from version "1.5.2" to "1.5.1".我将库从版本“1.5.2”降级到“1.5.1”。 Here are the steps:以下是步骤:

Change改变

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

To

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

Then ran following commands:然后运行以下命令:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM