react-native 报错RCTStatusBarManager modulce requires that the ‘‘ key inthe info.plist is set to No

版本信息

 react-native:0.64

一、报错截图信息

这个错误是个警告,不会影响运行只需要,鼠标按住往下拉就行了,但是每次yarn ios都会出现。

RCTStatusBarManager modulce requires that the UIViewControllerBasedStatusBarAppearance key inthe info.plist is set to No

大致意思就是:

RCTStatusBarManager模块要求info.plist中的UIViewControllerBasedStatusBarAppearance键设置为No

顾名思义就是需要找到项目中ios=>info.plist文件给这个key值设为No.

 

什么是Info.plist:

iOS中很多功能需要配置Info.plist才能实现,如设置后台运行、支持打开的文件类型等。了解Info.plist中各字段及其含义,可以访问苹果开发网站相关文档,info.plist文档说明-具体地址:https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html#//apple_ref/doc/uid/TP40009248-SW1

可以看看这篇博客info.plist知多少

 二、解决方案:

1.如果你是Mac本可以使用x-code(没有则需要去apple store搜索下载,实际上装react-native时已经下载过了)打开项目下ios目录下的info.plist。例如我的项目名是AwesomeProject,路径如下:AwesomeProject=>ios=>AwesomeProject=>info.plist

具体地址截图AwesomeProject=>ios=>AwesomeProject=>info.plist

找到 info.plist打开

打开后是这样的,找到UIViewControllerBasedStatusBarAppearance --可以看到它对应的是这个截图的最后一项View controller-based status bar appearance

它的为yes只需要改为no即可。

如果没有的话就加上一行鼠标放上去会显示加号,找到View controller-based status bar appearance 设置成no即可。

 

2.如果不是mac本用编辑器打开即可我用的是vs-code.

 info.plist代码搜索UIViewControllerBasedStatusBarAppearance 找到并把下面的<true/>改为<false/>

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>en</string>
	<key>CFBundleDisplayName</key>
	<string>test</string>
	<key>CFBundleExecutable</key>
	<string>$(EXECUTABLE_NAME)</string>
	<key>CFBundleIdentifier</key>
	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>$(PRODUCT_NAME)</string>
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleShortVersionString</key>
	<string>1.0</string>
	<key>CFBundleSignature</key>
	<string>????</string>
	<key>CFBundleVersion</key>
	<string>1</string>
	<key>LSRequiresIPhoneOS</key>
	<true/>
	<key>NSAppTransportSecurity</key>
	<dict>
		<key>NSExceptionDomains</key>
		<dict>
			<key>localhost</key>
			<dict>
				<key>NSExceptionAllowsInsecureHTTPLoads</key>
				<true/>
			</dict>
		</dict>
	</dict>
	<key>NSLocationWhenInUseUsageDescription</key>
	<string></string>
	<key>UILaunchStoryboardName</key>
	<string>LaunchScreen</string>
	<key>UIRequiredDeviceCapabilities</key>
	<array>
		<string>armv7</string>
	</array>
	<key>UISupportedInterfaceOrientations</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
		<string>UIInterfaceOrientationLandscapeLeft</string>
		<string>UIInterfaceOrientationLandscapeRight</string>
	</array>
	<key>UIViewControllerBasedStatusBarAppearance</key> //就是这个
	<false/> //如果是true需要把这个改成false
</dict>
</plist>

上面两种方法都需要重新运行项目(也就是根据你的配置重新运行,我是yarn ios)。

这是一类型错误RCTStatusBarManager modulce requires that the UIViewControllerBasedStatusBarAppearance key inthe info.plist is set to No

key前面的就是需要设置的项(黄色的),只要找到设置项根据它的要求改即可(绿色的)。

No对应的是false(<false/>)。Yes对应的是true(<true/>)。

遇到问题先去issues里找 github react-native isseus--https://github.com/facebook/react-native/issues 也可以自己提问。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

崽崽的谷雨

漫漫前端路,摸爬滚打

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值