{"id":1018,"date":"2018-02-07T18:33:24","date_gmt":"2018-02-07T18:33:24","guid":{"rendered":"http:\/\/bitcows.com\/?p=1018"},"modified":"2018-02-07T18:33:24","modified_gmt":"2018-02-07T18:33:24","slug":"adding-axway-appcelerator-platform-services-to-your-app-using-swift-4","status":"publish","type":"post","link":"https:\/\/bitcows.com\/?p=1018","title":{"rendered":"Adding Axway Appcelerator Platform Services to your app (Using Swift 4)"},"content":{"rendered":"<p>The following are the step-by-step instructions for how to install the Platform Services SDK for this native Swift (4) Xcode project. Once installed, use the appropriate key below to enable for Development or Production modes. Development is the mode during which you are doing development or during pre-production testing. You should only use the Production key when doing a release build to either the iTunes store or when you are releasing through Enterprise distribution. PS: if you are not using Xcode 7 or up.. really? Why not get the latest stuff!<\/p>\n<p><strong>Step 1 \u2014  Download and unzip the SDK (this will happen after you <a target=\"_new\" href=\"https:\/\/platform.axway.com\/#\/app.new\" rel=\"noopener\">register<\/a> your app for services)<\/strong><\/p>\n<p><strong>Step 2 \u2014 Add the SDK to your Xcode project<\/strong><\/p>\n<p>Xcode 6 and later, drag the Appcelerator.framework folder into the root of your project, making sure Copy items into destination is checked, and click Finish.<\/p>\n<p><strong>Step 3 \u2014 Add Dependencies<\/strong><\/p>\n<p>On your project&#8217;s Build Phases tab, expand Link Binary With Libraries section and add the <code>libsqlite3.tbd<\/code> and <code>libz.tbd<\/code> frameworks.<\/p>\n<p><strong>Step 4 \u2014 Add Linker Flag<\/strong><\/p>\n<p>On your project&#8217;s Build Settings tab, click the All button in the top-left corner of the tab. Then expand the Linking section and add <code>-ObjC<\/code> to Other Linker Flags.<\/p>\n<p><strong>Step 5 \u2014 Disable Bitcode<\/strong><\/p>\n<p>For Xcode 7 and later, you need to disable bitcode since not all dependent third-party libraries have it enabled. In the Build Settings tab, expand the Build Options section and set Enable Bitcode to No.<\/p>\n<p><strong>Step 6 \u2014 Import Appcelerator.h using a bridging header<\/strong><br \/>\n<code>File<\/code> > <code>New<\/code> > <code>File<\/code> > <code>(iOS, watchOS, tvOS, or macOS)<\/code> > <code>Source<\/code> > <code>Header File<\/code>. Name it [YOUR PROJECT NAME]-Bridging-Header.h and put it in your root directory [YOUR PROJECT NAME].<\/p>\n<p>In Build Settings, in Swift Compiler &#8211; Code Generation, make sure the Objective-C Bridging Header build setting has a path to the bridging header file.<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/bitcows.com\/wp-content\/uploads\/2018\/02\/Screen-Shot-2018-02-07-at-11.12.17-AM.png\" alt=\"\" width=\"977\" height=\"503\" class=\"alignnone size-full wp-image-1019\" \/><\/p>\n<p>Now in the Bridge-Header file add<br \/>\n<code>#import &lt;Appcelerator\/Appcelerator.h&gt;<\/code><\/p>\n<p><strong>Step 7 &#8211; Initialize services<\/strong><\/p>\n<p>Select your deployment environment<br \/>\nAdd the code below to your application delegate&#8217;s<br \/>\n<code>func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool<\/code>  method.<\/p>\n<p>Add:<br \/>\n<code>APSServiceManager.sharedInstance().enable(withAppKey:\"[YOU APPLICATION KEY WILL BE HERE]\")<\/code><\/p>\n<p>Now you&#8217;re ready to start making service requests. See the <a href=\"https:\/\/docs.appcelerator.com\/platform\/latest\/#!\/guide\/Quick_Start_Guide_for_iOS_APS_SDK\" rel=\"noopener\" target=\"_blank\">Quick Start Guide for iOS APS SDK<\/a> for making requests to the Cloud, Performance, and Analytics services.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The following are the step-by-step instructions for how to install the Platform Services SDK for this native Swift (4) Xcode project. Once installed, use the appropriate key below to enable for Development or Production modes. Development is the mode during which you are doing development or during pre-production testing. You should only use the Production&hellip;<\/p>\n<p class=\"more-link\"><a href=\"https:\/\/bitcows.com\/?p=1018\" class=\"themebutton\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":1033,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5,6,15,16,18,22,23],"tags":[51,53],"class_list":["post-1018","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-api-builder","category-appcelerator","category-arrowdb","category-ios","category-code-examples","category-iphone","category-mbaas","category-mobile-backend-services","tag-mbaas","tag-mobile-backend-services"],"_links":{"self":[{"href":"https:\/\/bitcows.com\/index.php?rest_route=\/wp\/v2\/posts\/1018","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bitcows.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bitcows.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bitcows.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bitcows.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1018"}],"version-history":[{"count":0,"href":"https:\/\/bitcows.com\/index.php?rest_route=\/wp\/v2\/posts\/1018\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/bitcows.com\/index.php?rest_route=\/"}],"wp:attachment":[{"href":"https:\/\/bitcows.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1018"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bitcows.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1018"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bitcows.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1018"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}