{"id":1997,"date":"2015-08-25T04:25:38","date_gmt":"2015-08-25T08:25:38","guid":{"rendered":"http:\/\/www.rexfeng.com\/blog\/?p=1997"},"modified":"2015-08-25T04:25:38","modified_gmt":"2015-08-25T08:25:38","slug":"logging-during-development-with-apple-watch-hardware","status":"publish","type":"post","link":"https:\/\/www.rexfeng.com\/blog\/2015\/08\/logging-during-development-with-apple-watch-hardware\/","title":{"rendered":"Logging during development with Apple Watch hardware"},"content":{"rendered":"<p>Inserting breakpoints or logging statements (such as NSLog) is relatively straightforward with an iPhone-only iOS app. But how do you log from\u00a0the WatchKit Extension (aka Watch app)?<\/p>\n<p>The good news is that logging isn&#8217;t\u00a0filled with many complicated steps. The bad news is that the logging works\u00a0intermittently.<\/p>\n<ol>\n<li>Add your NSLog statements in your\u00a0WatchKit Extension. This is probably your\u00a0<em>InterfaceController.m<\/em><\/li>\n<li>Run the watch app on <strong>iOS Device + watchOS Device<\/strong> (in the WatchKit App scheme)<\/li>\n<li>Select Debug &gt; Attach to Process &gt; (click on your watch app name)<\/li>\n<li>Profit! You should see your NSLogs when they are triggered in the app lifecycle in Xcode<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-1998\" src=\"http:\/\/www.rexfeng.com\/blog\/wp-content\/uploads\/2015\/08\/debug-531x540.png\" alt=\"debug\" width=\"531\" height=\"540\" srcset=\"https:\/\/www.rexfeng.com\/blog\/wp-content\/uploads\/2015\/08\/debug-531x540.png 531w, https:\/\/www.rexfeng.com\/blog\/wp-content\/uploads\/2015\/08\/debug-147x150.png 147w, https:\/\/www.rexfeng.com\/blog\/wp-content\/uploads\/2015\/08\/debug-295x300.png 295w, https:\/\/www.rexfeng.com\/blog\/wp-content\/uploads\/2015\/08\/debug-624x635.png 624w, https:\/\/www.rexfeng.com\/blog\/wp-content\/uploads\/2015\/08\/debug.png 694w\" sizes=\"auto, (max-width: 531px) 100vw, 531px\" \/><\/p>\n<p>If logging isn&#8217;t working, try typical Xcode debug steps such as:<\/p>\n<ul>\n<li>deleting the app on your phone &amp; re-running it in Xcode<\/li>\n<li>restarting the phone and\/or watch devices<\/li>\n<li>clean Xcode (cmd + shift + k) and re-run the app<\/li>\n<li>quit &amp; restart Xcode<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Inserting breakpoints or logging statements (such as NSLog) is relatively straightforward with an iPhone-only iOS app. But how do you log from\u00a0the WatchKit Extension (aka Watch app)? The good news is that logging isn&#8217;t\u00a0filled with many complicated steps. The bad news is that the logging works\u00a0intermittently. Add your NSLog statements in your\u00a0WatchKit Extension. This is [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1029],"tags":[380,1215,1168,966,1225,813,1212,1086],"class_list":["post-1997","post","type-post","status-publish","format-standard","hentry","category-programming","tag-apple","tag-debug","tag-development","tag-ios","tag-logging","tag-watch","tag-watchkit","tag-xcode"],"_links":{"self":[{"href":"https:\/\/www.rexfeng.com\/blog\/wp-json\/wp\/v2\/posts\/1997","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rexfeng.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rexfeng.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rexfeng.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rexfeng.com\/blog\/wp-json\/wp\/v2\/comments?post=1997"}],"version-history":[{"count":2,"href":"https:\/\/www.rexfeng.com\/blog\/wp-json\/wp\/v2\/posts\/1997\/revisions"}],"predecessor-version":[{"id":2000,"href":"https:\/\/www.rexfeng.com\/blog\/wp-json\/wp\/v2\/posts\/1997\/revisions\/2000"}],"wp:attachment":[{"href":"https:\/\/www.rexfeng.com\/blog\/wp-json\/wp\/v2\/media?parent=1997"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rexfeng.com\/blog\/wp-json\/wp\/v2\/categories?post=1997"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rexfeng.com\/blog\/wp-json\/wp\/v2\/tags?post=1997"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}