美文网首页移动开发-iOSiOS
xcode 打印debug 和 报错整合

xcode 打印debug 和 报错整合

作者: edison0428 | 来源:发表于2017-02-11 10:37 被阅读2508次

1:打印的相关

 2017-02-11 10:33:22.289934 XMM[769:23111] [SDKLibrary] Not authorized, skipping filter predicate application
2017-02-11 10:33:22.316 XMM[769:23111] year=2017 month =2 day=11
2017-02-11 10:33:22.317 XMM[769:23111] modeCount=0 5
2017-02-11 10:33:22.388728 XMM[769:23155] [] nw_host_stats_add_src recv too small, received 24, expected 28
2017-02-11 10:33:22.395042 XMM[769:23155] [] ____nwlog_simulate_crash_inner_block_invoke dlopen CrashReporterSupport failed
2017-02-11 10:33:22.395748 XMM[769:23155] [] __nwlog_err_simulate_crash simulate crash failed "nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available"
2017-02-11 10:33:22.397328 XMM[769:23155] [] nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available, dumping backtrace:
        [x86_64] libnetcore-856.30.16
    0   libsystem_network.dylib             0x0000000115341666 __nw_create_backtrace_string + 123
    1   libnetwork.dylib                    0x0000000115b3c006 nw_socket_add_input_handler + 3164
    2   libnetwork.dylib                    0x0000000115b19555 nw_endpoint_flow_attach_protocols + 3768
    3   libnetwork.dylib                    0x0000000115b18572 nw_endpoint_flow_setup_socket + 563
    4   libnetwork.dylib                    0x0000000115b17298 -[NWConcrete_nw_endpoint_flow startWithHandler:] + 2612
    5   libnetwork.dylib                    0x0000000115b32ae1 nw_endpoint_handler_path_change + 1261
    6   libnetwork.dylib                    0x0000000115b32510 nw_endpoint_handler_start + 570
    7   libnetwork.dylib                    0x0000000115b4a1f9 nw_endpoint_resolver_start_next_child + 2240
    8   libdispatch.dylib                   0x00000001150be978 _dispatch_call_block_and_release + 12
    9   libdispatch.dylib                   0x00000001150e80cd _dispatch_client_callout + 8
    10  libdispatch.dylib                   0x00000001150c5e17 _dispatch_queue_serial_drain + 236
    11  libdispatch.dylib                   0x00000001150c6b4b _dispatch_queue_invoke + 1073
    12  libdispatch.dylib                   0x00000001150c9385 _dispatch_root_queue_drain + 720
    13  libdispatch.dylib                   0x00000001150c9059 _dispatch_worker_thread3 + 123
    14  libsystem_pthread.dylib             0x00000001155744de _pthread_wqthread + 1129
    15  libsystem_pthread.dylib             0x0000000115572341 start_wqthread + 13
2017-02-11 10:33:22.480 XMM[769:23111] ------ok
2017-02-11 10:33:25.437395 XMM[769:23153] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/user/Library/Developer/CoreSimulator/Devices/782B3AB9-B226-46FB-A70B-802CEE048CD0/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2017-02-11 10:33:25.438011 XMM[769:23153] [MC] Reading from private effective user settings.

解决方案:

14D06F31-A239-4ADC-B44F-8837F1882675.png
2017-02-22 18:09:11.687139 NSURLSessionTest[1627:136135] [] nw_host_stats_add_src recv too small, received 24, expected 28
2017-02-22 18:09:11.687754 NSURLSessionTest[1627:136135] [] nw_host_stats_add_src recv too small, received 24, expected 28
2017-02-22 18:09:11.690138 NSURLSessionTest[1627:136135] [] nw_host_stats_add_src recv too small, received 24, expected 28
2017-02-22 18:09:11.693879 NSURLSessionTest[1627:136136] [] nw_host_stats_add_src recv too small, received 24, expected 28

解决方法根第一个一样

3.升级Xcode8之后,会打印一些烦人的Log信息,隐藏不需要的Xcode8日志,
解决的办法:就是设置 OS_ACTIVITY_MODE = disable,这样做在模拟器上是正常的,但是iOS10真机测试所有的Log日志全部被屏蔽了!这不是之前设置导致的,而是iOS10为了在真机上提高性能,所以把Log日志给屏蔽了。

解决方案:
自定义Log 需要用printf()进行转换,真机才能输出日志

// 可以输出纯净的内容:NSLog去掉时间戳及其他输出样式
#ifdef DEBUG
#define NNSLog(FORMAT, ...) fprintf(stderr,"%s\n",[[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
#else
#define NNSLog(...)
#endif

// 我推荐用这个打印我们的日志:功能、行数
#ifdef DEBUG
#define NSSLog(FORMAT, ...) fprintf(stderr,"%s:%d\t%s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
#else
#define NSSLog(...)
#endif

3.报错:-[__NSCFNumber length]: unrecognized selector sent to instance

解决方案:
这个问题大部分是类型转换错误,检查起来可能比较麻烦,个人聚的最好的办法就是一个一个的控制器注释,这样查找问题也快很多

相关文章

  • xcode 打印debug 和 报错整合

    1:打印的相关 解决方案: 解决方法根第一个一样 3.升级Xcode8之后,会打印一些烦人的Log信息,隐藏不需要...

  • xcode 打印debug 和 报错

    1:打印的相关 2017-02-1110:33:22.289934XMM[769:23111] [SDKLibra...

  • error build: Command PhaseScript

    Xcode在真机run Debug或者打Debug包时报错 m1芯片Xcode没开 Rosetta,某同事真机/模...

  • 2019-11-19

    Xcode 控制台打印报错信息:reason: 'Modifications to the layout engi...

  • Xcode使用指南

    Xcode debug与release模式 iOS开发技巧(系列十七:使用Xcode DEBUG模式和RELEAS...

  • iOS 宏定义

    debug时打印,下面一句是解决xcode8打印不全的问题; 屏幕宽高,或者比例 NSUserDefaults 存...

  • Command CompileAssetCatalog fail

    几年前较老的工程 用 xcode 11 打开以后,debug报错,原因是最近版本的 xcode 需要必须 添加 L...

  • xcode替换证书后

    重启xcode 重新看一下signing是否debug和release的证书都统一正确没报错 删除本地过期证书 切...

  • xode Leak 的使用

    在iOS项目测试过程中,经常利用Xcode进行debug测试,某次测试debug时APP突然闪退,控制台打印log...

  • iOS 常见问题汇总

    Xcode debug时如何查看崩溃堆栈:First throw call stack不打印方法名 解决方案:1....

网友评论

    本文标题:xcode 打印debug 和 报错整合

    本文链接:https://www.haomeiwen.com/subject/ovanittx.html