Integration of the Swift library
Before starting, you must first download our SDK via the Tag Composer application by logging in to your AT Internet account, or use CocoaPods.
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 framework with content specific to iOS simulator and device targets.
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.
Open your Swift application via Xcode.
Please note, the Swift library is only compatible with iOS versions 8 and later.
To link our library with your project, select the corresponding target, then look for the section Embedded Binaries:
Linked only the correct framework regarding the type of your target: Tracker.framework for an application target or TrackerExtension.framework for an extension target.
Click finish, taking care to tick the box Copy items if needed. A file named Tracker.framework or TrackerExtension.framework will appear in your project’s file tree.
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.
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.
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
You have to modify the Podfile in your project.
You have to override the Tracker’s default configuration when using Cocoapods
Exemple de Podfile :
pod "ATInternet-Apple-SDK/Tracker",">=2.0" #iOS Tracker pod "ATInternet-Apple-SDK/tvOSTracker",">=2.0" #tvOS Tracker pod "ATInternet-Apple-SDK/watchOSTracker",">=2.0" #watchOS Tracker pod "ATInternet-Apple-SDK-TrackerExtension",">=2.0" #iOS AppExtension
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 :
github "at-internet/atinternet-apple-sdk" >=1.0
- 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
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 :
If you use a secured collecting server, add the following keys :
The library is now ready for use.
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
lipo -info Tracker.framework/Tracker # -> Architectures in the fat file: Tracker.framework/Tracker are: i386 x86_64 armv7 arm64
lipo -output Tracker.temp -remove x86_64 Tracker.framework/Tracker lipo -output Tracker -remove i386 Tracker.temp mv Tracker Tracker.framework/ rm Tracker.temp lipo -info Tracker.framework/Tracker # -> Architectures in the fat file: Tracker.framework/Tracker are: armv7 arm64Last update: 22/07/2019