{"id":9872,"date":"2021-12-12T12:32:23","date_gmt":"2021-12-12T12:32:23","guid":{"rendered":"https:\/\/www.applivery.com\/?post_type=docs&#038;p=9872"},"modified":"2025-01-29T08:24:02","modified_gmt":"2025-01-29T08:24:02","password":"","slug":"exclude-applivery-ios-sdk","status":"publish","type":"docs","link":"https:\/\/www.applivery.com\/pt-br\/docs\/mobile-app-distribution\/troubleshooting\/mobile-app-distribution-all\/exclude-applivery-ios-sdk\/","title":{"rendered":"Conditionally excluding Applivery iOS SDK based on the Environment"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"9872\" class=\"elementor 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>As you may already know, it\u2019s not allowed to use the Applivery SDK in production Apps that are released in the official Apps Stores (Google Play and Apple App Store). In addition, it is a practice that we do not recommend and that could cause the rejection of your App during the reviewing process.<\/p><p>This tutorial will guide you through the process of conditionally excluding the Applivery SDK based on the Environment of the App (i.e.: Live, Test, Staging or Quality).<\/p>\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\">Note<\/span>\n\t\t\t\n\t\t\t\t\t\t<span class=\"elementor-alert-description\">Please note that for the purpose of this tutorial, we are considering that you already know the basics of how to manage different environments by using Schemas and Configurations. If not, we recommend to take a look to the following <a href=\"https:\/\/www.freecodecamp.org\/news\/managing-different-environments-and-configurations-for-ios-projects-7970327dd9c9\/\">blog post<\/a>.<\/span>\n\t\t\t\n\t\t\t\t\t\t<button type=\"button\" class=\"elementor-alert-dismiss\" aria-label=\"Dismiss this alert.\">\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\">Step 1 - Create a Configuration Settings files (.xcconfig) for each of your environments<\/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>Go to <strong>File &gt; New &gt; File\u2026 (Command + N) -&gt; Configuration Settings file<\/strong> choose a descriptive name for your configuration file. For this example we will create two different Configuration Files, one for the development environment (<code>DEV.xcconfig<\/code>) and another one for the production environment (<code>PROD.xcconfig<\/code>).<\/p>\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>\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>Since we do not want the Applivery SDK to be included into the Production Environment, we have added the following line of code <code>EXCLUDED_SOURCE_FILE_NAMES = Applivery.framework<\/code> that will exclude the source files of the Applivery SDK during the process of building the App.<\/p><p>Additionally we will take advantage of this Configuration File to also define a different Applivery SDK Token for each of the environments.<\/p>\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\">Step 2 - Link the Configuration Files with your Project Schemas<\/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>Now that we have multiple configuration files that describe the particularities of your Environments it\u2019s time to link them with your project Schemas. To do so, under your <strong>Project Configurations settings<\/strong>, select the appropriate Configuration File by using the <strong>Build Configurations<\/strong> dropdown menu.<\/p>\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-9874\" 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\">Step 3 (optional) - Use Configuration File variables in your code<\/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-9875\" 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>Additionally, in order to use the <code>Info.plist<\/code> <strong>Keys<\/strong> in your code you can follow the next approach:<\/p>\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\">Step 4 - Conditionally use the SDK<\/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>Since the <strong>Import<\/strong> of the Applivery SDK has been excluded from the <code>.xcconfig<\/code> file when building the code we recommend to use <strong>Swift Compiler Custom Flags and Active Compilation Conditions<\/strong> to declare a set of constants that will help you conditionally start the Applivery SDK. Here is an example:<\/p>\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-9877\" 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>Alternatively, if you do not what to use Configuration Files, you can exclude certain <strong>Source File Names<\/strong> under the <strong>Build Settings<\/strong> of your project for each of your Project Schemes.<\/p>\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>Sometimes you will need to conditionally disable the Applivery SDK based on the environment (test, QA, quality, production). This tutorial will guide you step by step through the process in xcode.<\/p>\n","protected":false},"author":1,"featured_media":32390,"parent":9390,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"content-type":"","inline_featured_image":false,"footnotes":""},"product":[],"doc_category":[80],"doc_tag":[],"class_list":["post-9872","docs","type-docs","status-publish","format-standard","has-post-thumbnail","hentry","doc_category-troubleshooting"],"aioseo_notices":[],"year_month":"2026-05","word_count":557,"total_views":"1749","reactions":{"happy":"5","normal":"0","sad":"1"},"author_info":{"name":"applivery","author_nicename":"applivery","author_url":"https:\/\/www.applivery.com\/pt-br\/blog\/author\/applivery\/"},"doc_category_info":[{"term_name":"Troubleshooting","term_url":"https:\/\/www.applivery.com\/docs\/mobile-app-distribution\/troubleshooting\/"}],"doc_tag_info":[],"knowledge_base_info":[],"knowledge_base_slug":[],"_links":{"self":[{"href":"https:\/\/www.applivery.com\/pt-br\/wp-json\/wp\/v2\/docs\/9872","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.applivery.com\/pt-br\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.applivery.com\/pt-br\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.applivery.com\/pt-br\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.applivery.com\/pt-br\/wp-json\/wp\/v2\/comments?post=9872"}],"version-history":[{"count":20,"href":"https:\/\/www.applivery.com\/pt-br\/wp-json\/wp\/v2\/docs\/9872\/revisions"}],"predecessor-version":[{"id":53055,"href":"https:\/\/www.applivery.com\/pt-br\/wp-json\/wp\/v2\/docs\/9872\/revisions\/53055"}],"up":[{"embeddable":true,"href":"https:\/\/www.applivery.com\/pt-br\/wp-json\/wp\/v2\/docs\/9390"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.applivery.com\/pt-br\/wp-json\/wp\/v2\/media\/32390"}],"wp:attachment":[{"href":"https:\/\/www.applivery.com\/pt-br\/wp-json\/wp\/v2\/media?parent=9872"}],"wp:term":[{"taxonomy":"product","embeddable":true,"href":"https:\/\/www.applivery.com\/pt-br\/wp-json\/wp\/v2\/product?post=9872"},{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/www.applivery.com\/pt-br\/wp-json\/wp\/v2\/doc_category?post=9872"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.applivery.com\/pt-br\/wp-json\/wp\/v2\/doc_tag?post=9872"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}