{"id":781,"date":"2015-10-14T19:42:56","date_gmt":"2015-10-14T19:42:56","guid":{"rendered":"http:\/\/phyline.com\/blog\/?p=781"},"modified":"2016-02-27T17:00:55","modified_gmt":"2016-02-27T17:00:55","slug":"app-thinning-y-el-error-enable_bitcode","status":"publish","type":"post","link":"http:\/\/sophyonline.com\/blog\/2015\/10\/app-thinning-y-el-error-enable_bitcode\/","title":{"rendered":"App Thinning y el error: ENABLE_BITCODE"},"content":{"rendered":"<p><span style=\"font-family: helvetica, arial, sans-serif;\"><a href=\"http:\/\/sophyonline.com\/blog\/wp-content\/uploads\/2013\/01\/XCode_Objective-C.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-692\" src=\"http:\/\/sophyonline.com\/blog\/wp-content\/uploads\/2013\/01\/XCode_Objective-C.png\" alt=\"XCode_Objective-C\" width=\"451\" height=\"317\" \/><\/a><\/span><\/p>\n<p><span style=\"font-family: helvetica, arial, sans-serif;\">Con la introducci\u00f3n de iOS 9 de forma oficial hace unas semanas, es hora de mirar un poco m\u00e1s de cerca los temas que nos afectar\u00e1n con el cambio al momento de adaptar nuestro c\u00f3digo de una versi\u00f3n a otra. En esta entrega hablar\u00e9 sobre App Thinning y el error que nos arroja Xcode 7 al migrar nuestros proyectos creados en versiones anteriores: ENABLE_BITCODE.<\/span><\/p>\n<h2><span style=\"font-family: helvetica, arial, sans-serif;\">App Thinning<\/span><\/h2>\n<p><span style=\"font-family: helvetica, arial, sans-serif;\"><strong>ENABLE_BITCODE<\/strong>: \u00bfQu\u00e9 rayos es esto? cuando ejecutas tu app en Xcode 7, nos aparece este error (si est\u00e1s migrando tu proyecto). Pues Apple nos indica en su documentaci\u00f3n, que con la introducci\u00f3n del<strong> WatchOS <\/strong>y el <strong>tvOS<\/strong>\u00a0aparece un nuevo t\u00e9rmino:<span style=\"color: #800000;\"><strong>\u00a0&#8220;App Thinning&#8221;<\/strong><\/span>;\u00a0un sistema de optimizaci\u00f3n que se ha implementado para disminuir el tama\u00f1o que ocupa el OTA de iOS 9 y adem\u00e1s para ser aplicado a las aplicaciones que desarrollemos de ahora en adelante en cualquier SO (WatchOS, tvOS o iOS) lo que mejorar\u00e1 la experiencia de usuario.<\/span><\/p>\n<p><span style=\"font-family: helvetica, arial, sans-serif;\">Leamos el extracto:<\/span><\/p>\n<blockquote><p><span style=\"font-family: helvetica, arial, sans-serif;\"><a href=\"https:\/\/developer.apple.com\/library\/prerelease\/ios\/documentation\/IDEs\/Conceptual\/AppDistributionGuide\/AppThinning\/AppThinning.html\">The App Store and operating system optimize the installation of iOS and watchOS apps by tailoring app delivery to the capabilities of the user\u2019s particular device, with minimal footprint. This optimization, called\u00a0<em class=\"newTerm\">app thinning<\/em>, lets you create apps that use the most device features, occupy minimum disk space, and accommodate future updates that can be applied by Apple. Faster downloads and more space for other apps and content provides a better user experience.<\/a><\/span><\/p><\/blockquote>\n<p><span style=\"font-family: helvetica, arial, sans-serif;\">As\u00ed pues, App Thinning posee tres componentes:<\/span><\/p>\n<p><!--more--><\/p>\n<h3><span style=\"font-family: helvetica, arial, sans-serif;\">1.-\u00a0Slicing (iOS, tvOS)<\/span><\/h3>\n<p><span style=\"font-family: helvetica, arial, sans-serif;\">B\u00e1sicamente es un proceso que crea y pone a disposici\u00f3n diferentes variaciones del bundle (la arquitectura ejecutable y los recursos que necesita un target espec\u00edfico) de la app dependiendo del target seleccionado. Todo esto lo hace <strong>App Store<\/strong> al momento de subir la aplicaci\u00f3n; \u00a0las <strong>im\u00e1genes<\/strong>, por ejemplo, son divididas de acuerdo a la resoluci\u00f3n de cada dispositivo, de este modo se reduce notablemente el <strong>tama\u00f1o<\/strong> que ocupar\u00eda una app hecha para\u00a0iOS y tvOS al momento de instalarse en un iPhone.<\/span><\/p>\n<blockquote><p><span style=\"font-family: helvetica, arial, sans-serif;\"><em class=\"newTerm\">Slicing<\/em> is the process of creating and delivering variants of the app bundle for different target devices. A <em class=\"newTerm\">variant<\/em> contains only the executable architecture and resources that are needed for the target device. You continue to develop and upload full versions of your app to iTunes Connect. The App Store will create and deliver different variants based on the devices your app supports. Image resources are sliced according to their resolution and device family. GPU resources are sliced according to device capabilities. For tvOS apps, assets in catalogs shared between iOS and tvOS targets are sliced and large app icons are removed. When the user installs an app, a variant for the user\u2019s device is downloaded and installed.<\/span><\/p><\/blockquote>\n<p><span style=\"font-family: helvetica, arial, sans-serif;\">Todo este proceso lo realiza\u00a0de forma autom\u00e1tica Xcode cuando genera el archivo binario que se subir\u00e1 a Apple Store. Posteriormente, Apple Store verificar\u00e1 la versi\u00f3n del dispositivo que usa cada usuario al momento de descargar la app e instalar\u00e1 solo los recursos necesarios para esa arquitectura.<\/span><\/p>\n<h3><span style=\"font-family: helvetica, arial, sans-serif;\">2.- Bitcode (ENABLE_BITCODE)<\/span><\/h3>\n<p><span style=\"font-family: helvetica, arial, sans-serif;\">Y lo que nos ata\u00f1e realmente es esta secci\u00f3n, <strong>Bitcode<\/strong>. De acuerdo a la documentaci\u00f3n, es la representaci\u00f3n intermedia de un programa compilado, es decir, que al momento de subir nuestra app al App Store, si <strong>Apple<\/strong> considera necesario alterar el ejecutable de nuestra aplicaci\u00f3n (usualmente para re-optimizaci\u00f3n), podr\u00e1 hacerlo sin necesidad de que nosotros creemos un nuevo binario y tengamos que subirlo nuevamente. Sin embargo, no puede ejecutarse en todas las arquitecturas, sino en\u00a0x86 o ARM. De hecho, esta funcionalidad solo es posible obtenerla en <strong>Xcode<\/strong> <strong>7<\/strong>, por lo que \u00a0al momento de utilizar\u00a0nuestro proyecto desarrollado en Xcode 6 ahora en la versi\u00f3n de Xcode 7, nos aparece un error como el siguiente:<\/span><\/p>\n<p><span style=\"font-family: helvetica, arial, sans-serif;\"><a href=\"http:\/\/sophyonline.com\/blog\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-14-at-19.50.21.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-794 size-full\" src=\"http:\/\/sophyonline.com\/blog\/wp-content\/uploads\/2015\/10\/Screen-Shot-2015-10-14-at-19.50.21.png\" alt=\"Bitcode error Xcode 7 - ENABLE_BITCODE\u00a0\" width=\"1354\" height=\"302\" \/><\/a><\/span><\/p>\n<p><span style=\"font-family: helvetica, arial, sans-serif;\">No solo tenemos que habilitar la opci\u00f3n en nuestro target, sino que todos los <strong>frameworks<\/strong> que utilicemos (incluidos los de 3eros &#8230;ejem, cocoapods, ejem Parse, ejem Bolts, ejem etc) adem\u00e1s de las apps de <strong>watchOS<\/strong> tambi\u00e9n deben habilitarlo. Por ahora, esta funcionalidad es opcional, pero no pasar\u00e1 mucho tiempo hasta que Apple nos obligue a utilizarla. Mientras tanto, hay que darle tiempo a los desarrolladores\u00a0de\u00a0frameworks para que se adapten y adopten esta nueva funcionalidad. As\u00ed que puedes cambiar el flag a <strong>NO<\/strong> en la secci\u00f3n &#8220;<strong>Bulid Settings<\/strong>&#8220;.<\/span><\/p>\n<blockquote><p><span style=\"font-family: helvetica, arial, sans-serif;\"><em class=\"newTerm\">Bitcode<\/em> is an intermediate representation of a compiled program. Apps you upload to iTunes Connect that contain bitcode will be compiled and linked on the App Store. Including bitcode will allow Apple to re-optimize your app binary in the future without the need to submit a new version of your app to the store.<\/span><\/p>\n<p><span style=\"font-family: helvetica, arial, sans-serif;\">Xcode hides symbols generated during build time by default, so they are not readable by Apple. Only if you choose to include symbols when uploading your app to iTunes Connect would the symbols be sent to Apple. You must include symbols to receive crash reports from Apple.<\/span><\/p><\/blockquote>\n<h3><span style=\"font-family: helvetica, arial, sans-serif;\">3.- \u00a0On-Demand Resources (iOS, tvOS)<\/span><\/h3>\n<p><span style=\"font-family: helvetica, arial, sans-serif;\">Esta funcionalidad promete mejorar las descargas de aplicaciones y recursos (como fotos y audios) al etiquetarlas con palabras claves mientras las\u00a0solicitamos\u00a0grupalmente. Significa que App Store alojara los recursos y gestionar\u00e1 las descargas por nosotros, lo que\u00a0permitir\u00e1 descargas m\u00e1s r\u00e1pidas y disminuir\u00e1 el tama\u00f1o de las aplicaciones. Cuando queda poco espacio de disco o ya no se necesita esta funcionalidad, el sistema operativo lo depura autom\u00e1ticamente.<\/span><\/p>\n<p><span style=\"font-family: helvetica, arial, sans-serif;\">Esta opci\u00f3n debes configurarla en tu app, siguiendo las instrucciones\u00a0<a href=\"https:\/\/developer.apple.com\/library\/prerelease\/ios\/documentation\/FileManagement\/Conceptual\/On_Demand_Resources_Guide\/index.html#\/\/apple_ref\/doc\/uid\/TP40015083\">documentacion on-demand resources<\/a>\u00a0y utilizar\u00a0<a href=\"https:\/\/developer.apple.com\/library\/prerelease\/ios\/documentation\/Foundation\/Reference\/NSBundleResourceRequest_Class\/index.html#\/\/apple_ref\/doc\/uid\/TP40015084\">NSBundleResourceRequest<\/a>.<\/span><\/p>\n<p><span style=\"font-family: helvetica, arial, sans-serif;\">Pues eso es todo por hoy. Ahora, ya un poco m\u00e1s informados sobre estas nuevas funcionalidades que ofrece Apple, habr\u00e1 que comenzar a usarlas \ud83d\ude42<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h2><span style=\"font-family: helvetica, arial, sans-serif;\">\u00a0<\/span><\/h2>\n","protected":false},"excerpt":{"rendered":"<p>Con la introducci\u00f3n de iOS 9 de forma oficial hace unas semanas, es hora de mirar un poco m\u00e1s de cerca los temas que nos afectar\u00e1n con el cambio al momento de adaptar nuestro c\u00f3digo de una versi\u00f3n a otra. En esta entrega hablar\u00e9 sobre App Thinning y el error que nos arroja Xcode 7 <a class=\"read-more\" href=\"http:\/\/sophyonline.com\/blog\/2015\/10\/app-thinning-y-el-error-enable_bitcode\/\">&hellip;&nbsp;<span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","footnotes":""},"categories":[],"tags":[],"class_list":["post-781","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"http:\/\/sophyonline.com\/blog\/wp-json\/wp\/v2\/posts\/781","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/sophyonline.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/sophyonline.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/sophyonline.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/sophyonline.com\/blog\/wp-json\/wp\/v2\/comments?post=781"}],"version-history":[{"count":16,"href":"http:\/\/sophyonline.com\/blog\/wp-json\/wp\/v2\/posts\/781\/revisions"}],"predecessor-version":[{"id":822,"href":"http:\/\/sophyonline.com\/blog\/wp-json\/wp\/v2\/posts\/781\/revisions\/822"}],"wp:attachment":[{"href":"http:\/\/sophyonline.com\/blog\/wp-json\/wp\/v2\/media?parent=781"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/sophyonline.com\/blog\/wp-json\/wp\/v2\/categories?post=781"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/sophyonline.com\/blog\/wp-json\/wp\/v2\/tags?post=781"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}