美文网首页
xcode 打印debug 和 报错

xcode 打印debug 和 报错

作者: 小宋的简单生活 | 来源:发表于2017-03-30 16:37 被阅读46次

1:打印的相关

2017-02-1110:33:22.289934XMM[769:23111] [SDKLibrary] Not authorized, skippingfilterpredicate application2017-02-1110:33:22.316XMM[769:23111] year=2017month =2day=112017-02-1110:33:22.317XMM[769:23111] modeCount=052017-02-1110:33:22.388728XMM[769:23155] [] nw_host_stats_add_src recv too small, received24, expected282017-02-1110:33:22.395042XMM[769:23155] [] ____nwlog_simulate_crash_inner_block_invoke dlopen CrashReporterSupport failed2017-02-1110:33:22.395748XMM[769:23155] [] __nwlog_err_simulate_crash simulate crash failed"nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available"2017-02-1110:33:22.397328XMM[769:23155] [] nw_socket_set_common_sockopts setsockopt SO_NOAPNFALLBK failed: [42] Protocol not available, dumping backtrace:        [x86_64] libnetcore-856.30.160libsystem_network.dylib0x0000000115341666 __nw_create_backtrace_string +1231libnetwork.dylib0x0000000115b3c006 nw_socket_add_input_handler +31642libnetwork.dylib0x0000000115b19555 nw_endpoint_flow_attach_protocols +37683libnetwork.dylib0x0000000115b18572 nw_endpoint_flow_setup_socket +5634libnetwork.dylib0x0000000115b17298 -[NWConcrete_nw_endpoint_flow startWithHandler:] +26125libnetwork.dylib0x0000000115b32ae1 nw_endpoint_handler_path_change +12616libnetwork.dylib0x0000000115b32510 nw_endpoint_handler_start +5707libnetwork.dylib0x0000000115b4a1f9 nw_endpoint_resolver_start_next_child +22408libdispatch.dylib0x00000001150be978 _dispatch_call_block_and_release +129libdispatch.dylib0x00000001150e80cd _dispatch_client_callout +810libdispatch.dylib0x00000001150c5e17 _dispatch_queue_serial_drain +23611libdispatch.dylib0x00000001150c6b4b _dispatch_queue_invoke +107312libdispatch.dylib0x00000001150c9385 _dispatch_root_queue_drain +72013libdispatch.dylib0x00000001150c9059 _dispatch_worker_thread3 +12314libsystem_pthread.dylib0x00000001155744de _pthread_wqthread +112915libsystem_pthread.dylib0x0000000115572341 start_wqthread +132017-02-1110:33:22.480XMM[769:23111] ------ok2017-02-1110:33:25.437395XMM[769:23153] [MC] System group containerforsystemgroup.com.apple.configurationprofilespath is /Users/user/Library/Developer/CoreSimulator/Devices/782B3AB9-B226-46FB-A70B-802CEE048CD0/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles2017-02-1110:33:25.438011XMM[769:23153] [MC] Reading from private effective user settings.

解决方案:

14D06F31-A239-4ADC-B44F-8837F1882675.png

2.

2017-02-2218:09:11.687139NSURLSessionTest[1627:136135][]nw_host_stats_add_srcrecvtoosmall,received24,expected282017-02-2218:09:11.687754NSURLSessionTest[1627:136135][]nw_host_stats_add_srcrecvtoosmall,received24,expected282017-02-2218:09:11.690138NSURLSessionTest[1627:136135][]nw_host_stats_add_srcrecvtoosmall,received24,expected282017-02-2218:09:11.693879NSURLSessionTest[1627:136136][]nw_host_stats_add_srcrecvtoosmall,received24,expected28

解决方法根第一个一样

3.升级Xcode8之后,会打印一些烦人的Log信息,隐藏不需要的Xcode8日志,

解决的办法:就是设置 OS_ACTIVITY_MODE = disable,这样做在模拟器上是正常的,但是iOS10真机测试所有的Log日志全部被屏蔽了!这不是之前设置导致的,而是iOS10为了在真机上提高性能,所以把Log日志给屏蔽了。

解决方案:

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

// 可以输出纯净的内容:NSLog去掉时间戳及其他输出样式#ifdefDEBUG#defineNNSLog(FORMAT, ...) fprintf(stderr,"%s\n",[[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);#else#defineNNSLog(...)#endif// 我推荐用这个打印我们的日志:功能、行数#ifdefDEBUG#defineNSSLog(FORMAT, ...) fprintf(stderr,"%s:%d\t%s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);#else#defineNSSLog(...)#endif

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

解决方案:

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

全文转载!

相关文章

  • xcode 打印debug 和 报错

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

  • xcode 打印debug 和 报错整合

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

  • 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/ezlpottx.html