{"id":27711,"date":"2021-12-12T12:32:23","date_gmt":"2021-12-12T12:32:23","guid":{"rendered":"https:\/\/www.applivery.com\/docs\/todos-los-documentos-2\/exclude-applivery-ios-sdk\/"},"modified":"2025-01-30T10:31:25","modified_gmt":"2025-01-30T10:31:25","password":"","slug":"exclusion-sdk-ios","status":"publish","type":"docs","link":"https:\/\/www.applivery.com\/es\/docs\/distribucion-de-aplicaciones\/solucion-de-problemas-es-2\/mobile-app-distribution-all\/exclusion-sdk-ios\/","title":{"rendered":"Exclusi\u00f3n condicional del SDK de Applivery iOS basado en el entorno"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"27711\" class=\"elementor elementor-27711 elementor-9872\" data-elementor-post-type=\"docs\">\n\t\t\t\t<div class=\"elementor-element elementor-element-3996da5 e-con-full e-flex e-con e-parent\" data-id=\"3996da5\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t<div class=\"elementor-element elementor-element-ab662fd e-con-full e-flex e-con e-child\" data-id=\"ab662fd\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t<div class=\"elementor-element elementor-element-08d87d7 elementor-widget elementor-widget-text-editor\" data-id=\"08d87d7\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p>Como ya sabr\u00e1s, no se permite usar el SDK de Applivery en Apps de producci\u00f3n que se publican en las tiendas oficiales de Apps (Google Play y Apple App Store). Adem\u00e1s, es una pr\u00e1ctica que no recomendamos y podr\u00eda causar el rechazo de tu App durante el proceso de revisi\u00f3n. <\/p>\n<p>Este tutorial te guiar\u00e1 a trav\u00e9s del proceso de excluir condicionalmente el SDK de Applivery seg\u00fan el entorno de la App (es decir: Live, Test, Staging o Quality).<\/p>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5baf43f elementor-alert-info elementor-widget elementor-widget-alert\" data-id=\"5baf43f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"alert.default\">\n\t\t\t\t\t\t\t<div class=\"elementor-alert\" role=\"alert\">\n\n\t\t\t\t\t\t<span class=\"elementor-alert-title\">Nota<\/span>\n\t\t\t\n\t\t\t\t\t\t<span class=\"elementor-alert-description\"><p>Ten en cuenta que, para este tutorial, asumimos que ya sabes lo b\u00e1sico sobre c\u00f3mo gestionar diferentes entornos usando Schemas y Configuraciones. Si no es as\u00ed, te recomendamos que eches un vistazo a esta <a href=\"https:\/\/www.freecodecamp.org\/news\/managing-different-environments-and-configurations-for-ios-projects-7970327dd9c9\/\">publicaci\u00f3n de blog<\/a>. <\/p>\n<\/span>\n\t\t\t\n\t\t\t\t\t\t<button type=\"button\" class=\"elementor-alert-dismiss\" aria-label=\"Descartar esta alerta.\">\n\t\t\t\t\t\t\t\t\t<span aria-hidden=\"true\">&times;<\/span>\n\t\t\t\t\t\t\t<\/button>\n\t\t\t\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9665cf8 elementor-widget elementor-widget-heading\" data-id=\"9665cf8\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Paso 1 - Crea un archivo de Configuraci\u00f3n (.xcconfig) para cada uno de tus entornos<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2223a5d elementor-widget elementor-widget-text-editor\" data-id=\"2223a5d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p>Ve a <strong>Archivo &gt; Nuevo &gt; Archivo\u2026 (Command + N) -&gt; Configuraci\u00f3n de Ajustes.<\/strong> Pon un nombre descriptivo para tu archivo de configuraci\u00f3n. En este ejemplo, vamos a crear dos archivos de configuraci\u00f3n diferentes: uno para el entorno de desarrollo (<code>DEV.xcconfig<\/code>) y otro para el entorno de producci\u00f3n (<code>PROD.xcconfig<\/code>). <\/p>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ff030c9 elementor-widget elementor-widget-code-highlight\" data-id=\"ff030c9\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-swift line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-swift\">\n\t\t\t\t\t<xmp>\/\/ App Info\nAPP_NAME = My Awesome App [DEV]\nBUNDLE_IDENTIFIER = com.acme.awesome.dev\n\n\/\/ Environment\nENVIRONMENT = DEV\n\n\/\/ Applivery Options\nAPPLIVERY_TOKEN = b7C...2I6<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-fea56c4 elementor-widget elementor-widget-text-editor\" data-id=\"fea56c4\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p><b>PROD.xcconfig<\/b><\/p>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-dcd915b elementor-widget elementor-widget-code-highlight\" data-id=\"dcd915b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-swift line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-swift\">\n\t\t\t\t\t<xmp>\/\/ App Info\nAPP_NAME = My Awesome App [PROD]\nBUNDLE_IDENTIFIER = com.acme.awesome.dev\n\n\/\/ Environment\nENVIRONMENT = PROD\n\n\/\/ Applivery Options\nAPPLIVERY_TOKEN = 1gxC...66f\nEXCLUDED_SOURCE_FILE_NAMES = Applivery.framework<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8e53295 elementor-widget elementor-widget-text-editor\" data-id=\"8e53295\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p>Como no queremos que el SDK de Applivery se incluya en el entorno de producci\u00f3n, hemos a\u00f1adido la siguiente l\u00ednea de c\u00f3digo <code>EXCLUDED_SOURCE_FILE_NAMES = Applivery.framework<\/code> que excluir\u00e1 los archivos fuente del SDK de Applivery durante el proceso de construcci\u00f3n de la App.<\/p>\n<p>Adem\u00e1s, aprovecharemos este archivo de configuraci\u00f3n para definir un token diferente de Applivery SDK para cada entorno.<\/p>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-977b258 elementor-widget elementor-widget-heading\" data-id=\"977b258\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Paso 2 - Vincula los archivos de configuraci\u00f3n con los Schemas de tu proyecto<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ed5ecde elementor-widget elementor-widget-text-editor\" data-id=\"ed5ecde\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p>Ahora que tenemos varios archivos de configuraci\u00f3n que describen las particularidades de tus entornos, es hora de vincularlos con los Schemas de tu proyecto. Para hacerlo, en la <strong>configuraci\u00f3n de tu Proyecto<\/strong>, selecciona el archivo de configuraci\u00f3n adecuado usando el men\u00fa desplegable de <strong>Configuraciones de Build<\/strong>. <\/p>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-950623d elementor-widget elementor-widget-image\" data-id=\"950623d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"731\" height=\"251\" src=\"https:\/\/www.applivery.com\/wp-content\/uploads\/2021\/12\/ios-sdk-configurations-002.png\" class=\"attachment-large size-large wp-image-20338\" alt=\"\" srcset=\"https:\/\/www.applivery.com\/wp-content\/uploads\/2021\/12\/ios-sdk-configurations-002.png 731w, https:\/\/www.applivery.com\/wp-content\/uploads\/2021\/12\/ios-sdk-configurations-002-300x103.png 300w\" sizes=\"auto, (max-width: 731px) 100vw, 731px\" title=\"ios-sdk-configurations-002 | Applivery\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-251ca2b elementor-widget elementor-widget-heading\" data-id=\"251ca2b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Paso 3 (opcional) - Usa variables del archivo de configuraci\u00f3n en tu c\u00f3digo<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3fad131 elementor-widget elementor-widget-image\" data-id=\"3fad131\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"130\" src=\"https:\/\/www.applivery.com\/wp-content\/uploads\/2021\/12\/ios-sdk-configurations-003.png\" class=\"attachment-large size-large wp-image-20342\" alt=\"\" srcset=\"https:\/\/www.applivery.com\/wp-content\/uploads\/2021\/12\/ios-sdk-configurations-003.png 979w, https:\/\/www.applivery.com\/wp-content\/uploads\/2021\/12\/ios-sdk-configurations-003-300x49.png 300w, https:\/\/www.applivery.com\/wp-content\/uploads\/2021\/12\/ios-sdk-configurations-003-768x125.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" title=\"ios-sdk-configurations-003 | Applivery\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7527d8d elementor-widget elementor-widget-text-editor\" data-id=\"7527d8d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p>Adem\u00e1s, para usar las <code>Info.plist<\/code> <strong>claves<\/strong> en su c\u00f3digo, puede seguir el siguiente enfoque:<\/p>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-adc0ddc elementor-widget elementor-widget-code-highlight\" data-id=\"adc0ddc\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-swift line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-swift\">\n\t\t\t\t\t<xmp>\/\/ Get values from Info.plist\npublic func InfoDictionary(_ key: String) -> String {\n  guard let constant = Bundle.main.infoDictionary?[key] as? String else {\n    return \"CONSTANT NOT FOUND\"\n  }\n  return constant\n}\n\n\/\/ Example of usage of the above function when starting the Applivery SDK\napplivery.start(token:InfoDictionary(\"APPLIVERY_TOKEN\"), appStoreRelease: false)<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-32bc37d elementor-widget elementor-widget-heading\" data-id=\"32bc37d\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Paso 4 - Usa el SDK de manera condicional<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c829a4a elementor-widget elementor-widget-text-editor\" data-id=\"c829a4a\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p>Como la <strong>importaci\u00f3n<\/strong> del SDK de Applivery ha sido excluida del archivo <code>.xcconfig<\/code> cuando se construye el c\u00f3digo, te recomendamos usar <strong>Swift Compiler Custom Flags y Active Compilation Conditions<\/strong> para declarar un conjunto de constantes que te ayudar\u00e1n a iniciar el SDK de Applivery de forma condicional. Aqu\u00ed tienes un ejemplo: <\/p>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-20ea85b elementor-widget elementor-widget-code-highlight\" data-id=\"20ea85b\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-swift line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-swift\">\n\t\t\t\t\t<xmp>#if !APPSTORE\nimport Applivery\n#endif\nstruct AppliveryWrapper {\n   func setup() {\n       #if !APPSTORE && !DEBUG\n       let applivery = Applivery.shared\n       applivery.logLevel = .info\n       applivery.start(token:InfoDictionary(\"APPLIVERY_TOKEN\"), appStoreRelease: false)\n       #endif\n   }\n}<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2ac2738 elementor-widget elementor-widget-image\" data-id=\"2ac2738\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"515\" height=\"191\" src=\"https:\/\/www.applivery.com\/wp-content\/uploads\/2021\/12\/ios-sdk-configurations-004.png\" class=\"attachment-large size-large wp-image-20346\" alt=\"\" srcset=\"https:\/\/www.applivery.com\/wp-content\/uploads\/2021\/12\/ios-sdk-configurations-004.png 515w, https:\/\/www.applivery.com\/wp-content\/uploads\/2021\/12\/ios-sdk-configurations-004-300x111.png 300w\" sizes=\"auto, (max-width: 515px) 100vw, 515px\" title=\"ios-sdk-configurations-004 | Applivery\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c32cfb9 elementor-widget elementor-widget-text-editor\" data-id=\"c32cfb9\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t\t\t\t\t\t<p>Si no quieres usar archivos de configuraci\u00f3n, tambi\u00e9n puedes excluir ciertos <strong>nombres de archivos fuente<\/strong> en los <strong>Ajustes de la build<\/strong> de tu proyecto para cada uno de los Schemas de tu proyecto.<\/p>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>A veces tendr\u00e1s que deshabilitar condicionalmente el SDK de Applivery en funci\u00f3n del entorno (prueba, control de calidad, calidad, producci\u00f3n). Este tutorial te guiar\u00e1 paso a paso a trav\u00e9s del proceso en Xcode.<\/p>\n","protected":false},"author":1,"featured_media":23467,"parent":23683,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"content-type":"","inline_featured_image":false,"footnotes":""},"product":[],"doc_category":[247],"doc_tag":[],"class_list":["post-27711","docs","type-docs","status-publish","format-standard","has-post-thumbnail","hentry","doc_category-solucion-de-problemas-es-2"],"aioseo_notices":[],"year_month":"2026-05","word_count":592,"total_views":"863","reactions":{"happy":"0","normal":"0","sad":"1"},"author_info":{"name":"applivery","author_nicename":"applivery","author_url":"https:\/\/www.applivery.com\/es\/blog\/author\/applivery\/"},"doc_category_info":[{"term_name":"Soluci\u00f3n de problemas","term_url":"https:\/\/www.applivery.com\/es\/docs\/distribucion-de-aplicaciones\/solucion-de-problemas-es-2\/"}],"doc_tag_info":[],"knowledge_base_info":[],"knowledge_base_slug":[],"_links":{"self":[{"href":"https:\/\/www.applivery.com\/es\/wp-json\/wp\/v2\/docs\/27711","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.applivery.com\/es\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.applivery.com\/es\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.applivery.com\/es\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.applivery.com\/es\/wp-json\/wp\/v2\/comments?post=27711"}],"version-history":[{"count":7,"href":"https:\/\/www.applivery.com\/es\/wp-json\/wp\/v2\/docs\/27711\/revisions"}],"predecessor-version":[{"id":53100,"href":"https:\/\/www.applivery.com\/es\/wp-json\/wp\/v2\/docs\/27711\/revisions\/53100"}],"up":[{"embeddable":true,"href":"https:\/\/www.applivery.com\/es\/wp-json\/wp\/v2\/docs\/23683"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.applivery.com\/es\/wp-json\/wp\/v2\/media\/23467"}],"wp:attachment":[{"href":"https:\/\/www.applivery.com\/es\/wp-json\/wp\/v2\/media?parent=27711"}],"wp:term":[{"taxonomy":"product","embeddable":true,"href":"https:\/\/www.applivery.com\/es\/wp-json\/wp\/v2\/product?post=27711"},{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/www.applivery.com\/es\/wp-json\/wp\/v2\/doc_category?post=27711"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.applivery.com\/es\/wp-json\/wp\/v2\/doc_tag?post=27711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}