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];  
    } 
    

      

  • 相关阅读:
    设计规范理解
    JVM读书笔记
    springboot整合RabbitMQ
    springboot 整合Redis
    tomcat原理
    配置嵌入式Servlet容器
    Springboot自动配置原理
    Springboot启动原理
    Springboot配置文件加载顺序
    修改VisualSVN Server地址为ip地址,修改svn服务端地址为ip或者域名地址的方法
  • 原文地址:https://www.cnblogs.com/qiyer/p/7798138.html
Copyright © 2011-2022 走看看