Integration of the Swift library

  • iOS
  • watchOS
  • tvOS
 

Foreword

Before starting, you must first download our SDK via the Tag Composer application by logging in to your AT Internet account, or use CocoaPods.

 

Using TagComposer

 

Archive contents

Once set up and downloaded, decompress the archive contents onto your computer.
folder_content

In the archive there are a subfolder for tagging applications (app), and a subfolder for tagging application extensions (extension). For each subfolders, there are a folder with content specific to iOS simulator targets (simulator), and a folder with content specific to iOS device targets (device).

This last one contains also the items required to submit your application tagged with our SDK to the App Store. Files with extensions .bcsymbolmap and .dSYM are useful when you want to enable bitcode support and iTunes Connect crash reports.

The tagging framework is the file with the extension .framework.

 

Integration in Xcode

Open your Swift application via Xcode.

Please note, the Swift library is only compatible with iOS versions 8 and later.

swift_integration_xcode

To link our library with your project, select the corresponding target, then look for the section Embedded Binaries:

swift_integration_embedded_binaries Click the +, then on Add other… and select the previously decompressed library.

Linked only the correct framework regarding the type of your target: Tracker.framework for an application target or TrackerExtension.framework for an extension target.

swift_integration_add_other

Click finish, taking care to tick the box Copy items if needed. A file named SmartTracker.framework or TrackerExtension.framework will appear in your project’s file tree.

screen_embed_binary

If your project do not propose a section Embedded Binaries because of the type of your target (an extension Today Widget for example), you have to link our library in the Linked Frameworks and Libraries section, then add it to the application bundle in the section Copy Files (with the Frameworks destinations) of the Build Phases tab of your target parameters.

 

Swift > 3.2 & iOS SmartTracker

The SmartTracker library may use SocketIO, which has a strong dependency to CommonCrypto. If you get the error message “Missing required module ATCommon Crypto” you need to add the following build setting $(SRCROOT)/SmartTracker.framework/zlib into import paths :

If you don’t want to import those dependencies, please use the Tracker.framework library.

If you want to use crash reports from iTunes Connect and the bitcode support when submitting your application tagged with our SDK, you have to add a build phase Copy Files Phase to the compilation process of your application. Please, use the example above to configure your build phase :

Be sure to use .bcsymbolmap and .dSYM files of the same archive folder than your .framework file.

copy_files_phase

 

 

Integration in an Objective-C application

In order to integrate our framework in an Objective-C application, you will need one more step by editing the property Always Embed Swift Standard Libraries to Yes in Build Settings

 

integration-objc

 

 

Using CocoaPods

You have to modify the Podfile in your project.

You have to override the Tracker’s default configuration when using Cocoapods

Exemple de Podfile :

 

 

Using Carthage

You have to override the Tracker’s default configuration when using Carthage.

You must update the Cartfile in your projet by adding the line below :

  • After launching the carthage update command, add the dependency from Project/Carthage/Build/iOS/Tracker.framework in Linked Frameworks and Libraries
  • In project build phase, add a new run script phase with the command /usr/local/bin/carthage copy-frameworks and add $(SRCROOT)/Carthage/Build/iOS/Tracker.framework as input files
  • Finally in the project build phase, add a new copy files, select products directory then add the Tracker.framework.dSYM file

 

 

App Transport Security considerations

In the situation where your application is compiled with iOS 9 SDK, you have to add some configuration keys for managing Application Transport Security feature in the info.plist file of your target.

Be sure that you change the domain field xiti.com if you use a custom domain

If you use a non-secured collecting server, add the following keys :

Configuration ATS HTTP

If you use a secured collecting server, add the following keys :

Configuration ATS HTTPS

The library is now ready for use.

 

Submitting Your App to the Store

If you downloaded the framework from TagComposer, you are using a universal framework that is both compatible with devices (arm) and simulators (x86, i386…). In order to be able to push your App onto iTunes Connect you may have to remove the simulators’ binary code using the lipo tool.

Sample usage of lipo

Was this post helpful?
Yes
No
Last update: 29/08/2018