qiyer

         目前很多游戏在iPhone X手机 wifi情况下,启动时候闪退,在4G网络时候不闪退。

         闪退的log:

#0 Thread
NSUnknownKeyException
[<UIStatusBar_Modern 0x15f906160> valueForUndefinedKey:]: this class is not key value coding-compliant for the key foregroundView.

     这是项目中使用状态栏中图标判断当前网络的具体状态,而 iPhone X手机状态栏和其他版本手机存在差异,状态栏是多嵌套了一层,所以在读取时候需要注意。

         可以在代码里面搜索 foregroundView 这个关键字,找到位置进行必要修改。

   

NSArray *children;  
// 不能用 [[self deviceVersion] isEqualToString:@"iPhone X"] 来判断,因为模拟器不会返回 iPhone X  
if ([[application valueForKeyPath:@"_statusBar"] isKindOfClass:NSClassFromString(@"UIStatusBar_Modern")]) {  
  children = [[[[application valueForKeyPath:@"_statusBar"] valueForKeyPath:@"_statusBar"] valueForKeyPath:@"foregroundView"] subviews];  
} else {  
  children = [[[application valueForKeyPath:@"_statusBar"] valueForKeyPath:@"foregroundView"] subviews];  
} 

  

分类:

技术点:

相关文章:

  • 2021-08-25
  • 2021-09-23
  • 2021-12-24
  • 2021-06-16
  • 2021-12-02
  • 2021-05-25
  • 2021-06-05
猜你喜欢
  • 2021-12-13
  • 2022-12-23
  • 2022-12-23
  • 2021-12-15
  • 2022-12-23
  • 2022-01-11
相关资源
相似解决方案