xcode 打印debug 和 报错

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

解决方案:

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

全文转载!

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo...
    admxjx阅读 1,171评论 0 0
  • 1:打印的相关 解决方案: 解决方法根第一个一样 3.升级Xcode8之后,会打印一些烦人的Log信息,隐藏不需要...
    edison0428阅读 3,616评论 0 6
  • ———————————————回答好下面的足够了---------------------------------...
    恒爱DE问候阅读 1,770评论 0 4