{"id":22188,"date":"2018-07-19T16:13:06","date_gmt":"2018-07-19T20:13:06","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=22188"},"modified":"2019-07-30T09:51:55","modified_gmt":"2019-07-30T13:51:55","slug":"apple-doubling-down-on-blocking-private-api-use","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2018\/07\/19\/apple-doubling-down-on-blocking-private-api-use\/","title":{"rendered":"Apple Doubling Down on Blocking Private API Use"},"content":{"rendered":"<p><a href=\"https:\/\/twitter.com\/macguru17\/status\/1019541620985946112\">Max Seelemann<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/macguru17\/status\/1019541620985946112\">\n<p>Rumor has it, that Apple is recently pushing to double down on eliminating <em>any<\/em> and <em>every<\/em> use of private API.<\/p>\n<p>I&rsquo;m convinced that this is ill-fated and hurts the platform as a whole. Users get worse experiences, developers worse products, Apple a worse platform.<\/p>\n<p>Disclaimer: Of course, the use of private API is something to avoid at all costs. And it&rsquo;s good that Apple is pushing for the discontinuation of its use.<\/p>\n<p>But occasionally, it&rsquo;s the last resort to solve certain problems. Problems that affect UX and totally should be addressed.<\/p>\n<p>[&#8230;]<\/p>\n<p>But as developer of apps, we need to ship things. Even if the issue was fixed now, apps should be as bug-free as possible on all the OS&rsquo;es. iOS 11 is still the public release.<\/p>\n<p>So&#8230; we need a solution. Let&rsquo;s look at our options here.<\/p>\n<p>[&#8230;]<\/p>\n<p>1) Leave as-is, file radar, hope for eventual fix.<\/p>\n<p>Results in bad experience for some users. They are not able to use the app because of a certain title. That&rsquo;s a bug. Bad idea.<\/p>\n<p>(There even is an app review guideline against bugs. More in a moment.)<\/p>\n<p>2) Do not set a custom back title.<\/p>\n<p>This leads to worse user experience &#x2013; because we are no longer able to provide <em>better<\/em> context than what&rsquo;s the default.<\/p>\n<p>While this is a small example, take a dozen of them and you have a worse app. You get a <em>worse experience<\/em> for users.<\/p>\n<p>[&#8230;]<\/p>\n<p>5) Switch to non-native cross-platform toolkit.<\/p>\n<p>I know this is radical. But you&rsquo;re free to do whatever you want there. Style the UI with some CSS or something and no need for private API.<\/p>\n<p>But IMO nobody will want to use your app. Bad idea. Native wins. UIKit is the one to use.<\/p>\n<p>[&#8230;]<\/p>\n<p>Know what? In my one and a half <em>decades<\/em> as professional app developer, <em>all<\/em> my apps broke in some way on <em>every single<\/em> new OS that came out.<\/p>\n<p>Staring with Mac OS X 10.2, continuing to iOS 12 today.<\/p>\n<p>But absolutely <em>zero<\/em> of these breaks were caused by the use of private API.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/mpweiher\/status\/1019573500342931458\">Marcel Weiher<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/mpweiher\/status\/1019573500342931458\">\n<p>Pretty much the same in the last ~25 years or so.  Incidentally, NeXTStep releases tended to not break things. System updates were downright boring.<\/p>\n<\/blockquote>\n\n<p>I guess the issue for Apple is that <a href=\"https:\/\/twitter.com\/jckarter\/status\/1019583725145735168\">not all<\/a> developers are appropriately cautious about using private API responsibly. I would lean toward a policy of allowing private API use but not worrying about breaking the (non-existent) contract between releases. That provides an incentive to only use it as a last resort. As to the argument that private API lets apps do things and access data that they shouldn&rsquo;t be able to do, those cases should be treated as OS bugs because App Review can&rsquo;t guarantee that they will not be used, anyway.<\/p>\n\n<p>Long-term, I expect that Swift will make it <a href=\"https:\/\/mjtsai.com\/blog\/2016\/07\/17\/swift-classes-to-be-non-publicly-subclassable-by-default\/\">harder<\/a> for developers to access private API, which will lead to more problems like Seelemann describes. Banning a workaround doesn&rsquo;t make the original problem go away.<\/p>\n\n<p>Along similar lines, <a href=\"https:\/\/ashfurrow.com\/blog\/thinking-critically-about-apple\/\">Ash Furrow<\/a>:<\/p>\n<blockquote cite=\"https:\/\/ashfurrow.com\/blog\/thinking-critically-about-apple\/\">\n<p>Apple&rsquo;s stubborn refusal to provide a simple API to determine if you&rsquo;re on an iPhone X causes developers to check for hardcoded screen dimensions, which is worse than developers making device-specific layouts.<\/p>\n<\/blockquote>\n\n<p>Update (2018-07-27): See also: <a href=\"http:\/\/www.openradar.appspot.com\/radar?id=4941931180195840\">Open Radar<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Max Seelemann: Rumor has it, that Apple is recently pushing to double down on eliminating any and every use of private API. I&rsquo;m convinced that this is ill-fated and hurts the platform as a whole. Users get worse experiences, developers worse products, Apple a worse platform. Disclaimer: Of course, the use of private API is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2018-07-27T18:19:52Z","apple_news_api_id":"69d715f0-c9b3-4bf3-9088-e9741f81552e","apple_news_api_modified_at":"2019-07-30T13:52:06Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAQ==","apple_news_api_share_url":"https:\/\/apple.news\/AadcV8MmzS_OQiOl0H4FVLg","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":[],"tags":[1846,91,31,1472,30,1013,901],"class_list":["post-22188","post","type-post","status-publish","format-standard","hentry","tag-app-review","tag-appstore","tag-ios","tag-ios-11","tag-mac","tag-private-api","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/22188","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=22188"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/22188\/revisions"}],"predecessor-version":[{"id":22279,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/22188\/revisions\/22279"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=22188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=22188"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=22188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}