zoukankan      html  css  js  c++  java
  • iPhone X 游戏闪退:NSUnknownKeyException

             目前很多游戏在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];  
    } 
    

      

  • 相关阅读:
    pg常用命令
    dmhs
    Redis集群
    Redis哨兵高可用架构
    Redis外网无法连接的问题
    Redis主从
    Redis持久化
    Redis安装
    Mysql执行计划详解
    Mysql安装配置
  • 原文地址:https://www.cnblogs.com/qiyer/p/7798138.html
Copyright © 2011-2022 走看看