{"id":374,"date":"2015-03-13T10:46:10","date_gmt":"2015-03-13T02:46:10","guid":{"rendered":"http:\/\/www.yusian.com\/blog\/?p=374"},"modified":"2016-07-14T22:53:55","modified_gmt":"2016-07-14T14:53:55","slug":"%e5%85%b3%e4%ba%8e%e8%87%aa%e5%ae%9a%e4%b9%89nslog%e9%9c%80%e8%a6%81%e6%b3%a8%e6%84%8f%e7%9a%84%e4%b8%80%e7%82%b9-%e8%87%aa%e5%ae%9a%e4%b9%89salog","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/analysis\/2015\/03\/13\/104610374.html","title":{"rendered":"\u5173\u4e8e\u81ea\u5b9a\u4e49NSLog\u9700\u8981\u6ce8\u610f\u7684\u4e00\u70b9 (\u81ea\u5b9a\u4e49SALog)"},"content":{"rendered":"<p>\u76f8\u4fe1\u5f88\u591a\u5f00\u53d1\u4eba\u5458\u90fd\u4f1a\u81ea\u5b9a\u4e49NSLog\u7684\u8f93\u5165\u65b9\u5f0f\uff0c\u4e00\u65b9\u9762\u53ef\u4ee5\u81ea\u5b9a\u4e49\u81ea\u5df1\u7684\u8f93\u51fa\u683c\u5f0f\uff0c\u6709\u5229\u4e8e\u8c03\u8bd5\u7a0b\u5e8f\uff0c\u6bd4\u5982\u8bf4\u65e5\u5fd7\u8f93\u51fa\u65f6\u6253\u5370\u7a0b\u5e8f\u6240\u5728\u7684\u6587\u4ef6\u4e0e\u884c\u6570\uff1b\u53e6\u4e00\u65b9\u9762\u6709\u5229\u63a7\u5236\u65e5\u5fd7\u7684\u8f93\u51fa\uff0c\u6bd4\u5982\u8c03\u8bd5\u65f6\u8f93\u51fa\u65e5\u5fd7\uff0c\u4f46\u53d1\u5e03\u540e\u4e0d\u8f93\u51fa\u3002<br \/>\n\u793a\u4f8b\uff1a<\/p>\n<pre lang=\"objc\" line=\"1\">\/\/ \u81ea\u5b9a\u4e49\u8f93\u51fa SALog(...)\n#ifdef DEBUG\n#define SALog(...) NSLog(@\"%s-%d\u884c:%@\", __PRETTY_FUNCTION__, __LINE__, [NSString stringWithFormat:__VA_ARGS__])\n#else\n#define SALog(...)\n#endif<\/pre>\n<p>\u95ee\u9898\u6765\u4e86\uff0c\u5f88\u591a\u4eba\u90fd\u77e5\u9053#ifdef DEBUG\u7684\u610f\u4e49\u5728\u4e8e\u53ea\u6709\u8c03\u8bd5\u65f6\u624d\u8f93\u51fa\u65e5\u5fd7\uff0c\u53d1\u5e03\u65f6\u4e0d\u8f93\u51fa\u65e5\u5fd7\uff0c\u4f46\u5f88\u591a\u4eba\u90fd\u53ea\u77e5\u9053\u5728\u8c03\u8bd5\u65f6\u786e\u5b9e\u6709\u65e5\u5fd7\u8f93\u51fa\uff0c\u53ef\u53d1\u5e03\u5462\uff1f\u65e0\u4eba\u5173\u5fc3\u4e86\u3002\u5176\u5b9e\u6709\u4e2a\u5730\u65b9\u662f\u9700\u8981\u8bbe\u7f6e\u7684\uff0c<strong>Product&#8211;Scheme&#8211;Edit Scheme&#8211;Info<\/strong>\u4e2d\u7684<strong>Build Configuration<\/strong>\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a<!--more--><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-375\" src=\"http:\/\/www.yusian.com\/blog\/wp-content\/uploads\/2016\/07\/41D9259D-4393-49E8-AA8E-84A8B266869B.jpg\" alt=\"41D9259D-4393-49E8-AA8E-84A8B266869B\" width=\"600\" height=\"342\" \/><\/p>\n<p>\u8fd9\u4e2a\u5730\u65b9\u51b3\u5b9a\u4e86\u6211\u4eec\u7684\u7f16\u8bd1\u6a21\u5f0f\uff0c\u5982\u679c\u4f60\u4ee5Debug\u6a21\u5f0f\u7f16\u8bd1\u518d\u53d1\u5e03\uff0c\u90a3#ifdef DEBUG\u5c31\u6ca1\u6709\u610f\u4e49\u4e86\uff0c\u53d1\u5e03\u65f6\u8fd8\u662f\u4f1a\u8f93\u51fa\u4e00\u5927\u5806\u7684\u65e5\u5fd7\u4fe1\u606f\u3002<br \/>\n\u6240\u5728\uff0c\u5728\u53d1\u5e03\u7a0b\u5e8f\u65f6\uff0c\u8bf7\u8bb0\u5f97\u5c06\u8be5\u9009\u9879\u5207\u6362\u6210Release\uff01\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76f8\u4fe1\u5f88\u591a\u5f00\u53d1\u4eba\u5458\u90fd\u4f1a\u81ea\u5b9a\u4e49NSLog\u7684\u8f93\u5165\u65b9\u5f0f\uff0c\u4e00\u65b9\u9762\u53ef\u4ee5\u81ea\u5b9a\u4e49\u81ea\u5df1\u7684\u8f93\u51fa\u683c\u5f0f\uff0c\u6709\u5229\u4e8e\u8c03\u8bd5\u7a0b\u5e8f\uff0c\u6bd4\u5982\u8bf4\u65e5\u5fd7\u8f93\u51fa\u65f6\u6253\u5370\u7a0b\u5e8f\u6240\u5728\u7684\u6587\u4ef6\u4e0e\u884c\u6570\uff1b\u53e6\u4e00\u65b9\u9762\u6709\u5229\u63a7\u5236\u65e5\u5fd7\u7684\u8f93\u51fa\uff0c\u6bd4\u5982\u8c03\u8bd5\u65f6\u8f93\u51fa\u65e5\u5fd7\uff0c\u4f46\u53d1\u5e03\u540e\u4e0d\u8f93\u51fa\u3002 \u793a\u4f8b\uff1a \/\/ \u81ea\u5b9a\u4e49\u8f93\u51fa SALog(&#8230;) #ifdef DEBUG #define SALog(&#8230;) NSLog(@&#8221;%s-%d\u884c:%@&#8221;, __PRETTY_FUNCTION__, __LINE__, [NSString stringWithFormat:__VA_ARGS__]) #else #define SALog(&#8230;) #endif \u95ee\u9898\u6765\u4e86\uff0c\u5f88\u591a\u4eba\u90fd\u77e5\u9053#ifdef DEBUG\u7684\u610f\u4e49\u5728\u4e8e\u53ea\u6709\u8c03\u8bd5\u65f6\u624d\u8f93\u51fa\u65e5\u5fd7\uff0c\u53d1\u5e03\u65f6\u4e0d\u8f93\u51fa\u65e5\u5fd7\uff0c\u4f46\u5f88\u591a\u4eba\u90fd\u53ea\u77e5\u9053\u5728\u8c03\u8bd5\u65f6\u786e\u5b9e\u6709\u65e5\u5fd7\u8f93\u51fa\uff0c\u53ef\u53d1\u5e03\u5462\uff1f\u65e0\u4eba\u5173\u5fc3\u4e86\u3002\u5176\u5b9e\u6709\u4e2a\u5730\u65b9\u662f\u9700\u8981\u8bbe\u7f6e\u7684\uff0cProduct&#8211;Scheme&#8211;Edit Scheme&#8211;Info\u4e2d\u7684Build Configuration\uff0c\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[17],"class_list":["post-374","post","type-post","status-publish","format-standard","hentry","category-analysis","tag-skill"],"_links":{"self":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/374","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/comments?post=374"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/374\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=374"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=374"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=374"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}