{"id":41081,"date":"2023-11-15T16:01:52","date_gmt":"2023-11-15T21:01:52","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=41081"},"modified":"2023-11-15T21:39:24","modified_gmt":"2023-11-16T02:39:24","slug":"xcode-15-logs-nil-as-an-empty-string","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2023\/11\/15\/xcode-15-logs-nil-as-an-empty-string\/","title":{"rendered":"Xcode 15 Logs nil As an Empty String"},"content":{"rendered":"<p><a href=\"https:\/\/lapcatsoftware.com\/articles\/2023\/10\/3.html\">Jeff Johnson<\/a>:<\/p>\n<blockquote cite=\"https:\/\/lapcatsoftware.com\/articles\/2023\/10\/3.html\"><p>[The] functions <code>os_log<\/code> and <code>NSLog<\/code> now log <code>nil<\/code> as an empty string. The previous behavior, going back forever as far as I remember, was to log <code>nil<\/code> as <code>(null)<\/code>.<\/p><p>[&#8230;]<\/p><p>I don&rsquo;t know whether this is a bug or intended behavior, but it makes debugging our apps markedly worse, because now there&rsquo;s no easy way to identify <code>nil<\/code> objects or to distinguish between <code>nil<\/code> and <code>@\"\"<\/code> in the log output.<\/p><\/blockquote>\n<p>This only affects logging within Xcode itself. Still not good, though.<\/p>\n\n<p><a href=\"https:\/\/lapcatsoftware.com\/articles\/2023\/10\/5.html\">Jeff Johnson<\/a>:<\/p>\n<blockquote cite=\"https:\/\/lapcatsoftware.com\/articles\/2023\/10\/5.html\"><p>I&rsquo;ve now found three different bugs in the new Xcode 15 console.<\/p><p>[&#8230;]<\/p><p>Fortunately, I&rsquo;ve found a way to restore the previous console behavior from Xcode 14 and earlier. This is actually noted in the <a href=\"https:\/\/developer.apple.com\/documentation\/xcode-release-notes\/xcode-15-release-notes#Console\">Xcode 15 release notes<\/a>, but I wanted to highlight the solution here in case, like me, you hadn&rsquo;t read the release notes recently[&#8230;]<\/p><p>[&#8230;]<\/p><p>You need to set the environment variable <code>IDELogRedirectionPolicy<\/code> to the value <code>oslogToStdio<\/code> in the Run section of your app&rsquo;s Xcode scheme. I wish there were a way to make this behavior the default in Xcode Settings!<\/p><\/blockquote>\n\n<p><a href=\"https:\/\/lapcatsoftware.com\/articles\/2023\/11\/1.html\">Jeff Johnson<\/a>:<\/p>\n<blockquote cite=\"https:\/\/lapcatsoftware.com\/articles\/2023\/11\/1.html\"><p>Since then I&rsquo;ve had some back and forth with Apple on that bug in Feedback Assistant. I&rsquo;m going to screenshot the entire exchange below. For context, if you&rsquo;re not familiar with Apple&rsquo;s bug reporting system, they constantly ask developers to &ldquo;Please verify this issue&rdquo; with the latest betas, despite having done nothing to fix the issue in the latest betas, in the hope that the issue (or maybe the developer) will magically go away.<\/p><p>[&#8230;]<\/p><p>The ultimate outcome of this case was that Apple blatantly lied to me&mdash;&ldquo;As you&rsquo;ve indicated, this issue is resolved&rdquo;&mdash;and then Apple refused to hear any contradiction to their lie&mdash;&rdquo;this Feedback will no longer be monitored, and incoming messages will not be reviewed.&rdquo; This kind of response reinforces what I said earlier in the exchange: &ldquo;It makes me not want to file feedbacks at all. It feels like you don&rsquo;t care.&rdquo; The coup de gr&acirc;ce was &ldquo;We appreciate your feedback.&rdquo; No, Apple absolutely does not appreciate our feedback.<\/p><\/blockquote>\n\n<p>In this case, Apple considers it resolved because the problem doesn&rsquo;t occur on Sonoma. But Xcode 15 is supposed to work on Ventura, and it <em>should<\/em> be fully functional there considering that Apple doesn&rsquo;t support Xcode 14 on Sonoma.<\/p>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2023\/10\/19\/xcode-15-0-1\/\">Xcode 15.0.1<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2023\/06\/09\/feedback-through-an-intermediary\/\">Feedback Through an Intermediary<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Jeff Johnson: [The] functions os_log and NSLog now log nil as an empty string. The previous behavior, going back forever as far as I remember, was to log nil as (null).[&#8230;]I don&rsquo;t know whether this is a bug or intended behavior, but it makes debugging our apps markedly worse, because now there&rsquo;s no easy way [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2023-11-15T21:01:54Z","apple_news_api_id":"0074a446-0371-4f7a-a08b-581754488937","apple_news_api_modified_at":"2023-11-16T02:39:26Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAQ==","apple_news_api_share_url":"https:\/\/apple.news\/AAHSkRgNxT3qgi1gXVEiJNw","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[30,2223,2385,1504,71,2109,226],"class_list":["post-41081","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-mac","tag-macos-13-ventura","tag-macos-14-sonoma","tag-os_log","tag-programming","tag-radar-and-feedback-assistant","tag-xcode"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/41081","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=41081"}],"version-history":[{"count":3,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/41081\/revisions"}],"predecessor-version":[{"id":41086,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/41081\/revisions\/41086"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=41081"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=41081"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=41081"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}