What you will learn
You will learn:
- to configure your Podfile with our Gitlab and our SDK
- to configure the SDK in your application
Prerequisites - What you need to get started
- Your SDK credentials, including an SDK Login, Password, and Company Key to initialize the SDK.
- A QR Code, which has been configured on your account, in order to test interactions with your app.
- A BLE beacon, which has been configured on your account, in order to test interactions with your app.
- An iOS Device, with iOs 8 and above.
- The Xcode application, which you can download from the App store.
Step 1: Clone the sdk-tutorial repository
- Clone the sdk-tutorial repository
git clone https://github.com/Connecthings/sdk-tutorial.git
- Open the iOs>qrCode>QrScannerDemo folder from the cloned sdk-tutorial folder
Step 2: Configure a Podfile with our Gitlab link
- Install CocoaPods
$gem install cocoapods
- Create a Podfile. This can be done by running
$touch Podfileand add your dependencies
source 'https://github.com/CocoaPods/Specs.git' source 'https://forge.adtag.eu/pub/Specs' platform :ios, '8.0' target 'QrScannerDemo' do # Uncomment this line if you're using Swift or would like to use dynamic frameworks use_frameworks! pod "ATQR", '~> 2.7' # Pods for QrScannerDemo end
Check out the Cocoapods site for more information
$pod updatein your project directory.
- Open App.xcworkspace that was created.
You should add libqlite3 Frameworks into your app project.
Step 3: Launch our sample into Xcode
- Open the QrScannerDemo.xcworkspace project with Xcode.
- Open the class AppDelegate.m.
- Configure the AdtagInitializer with the received informations from Connecthings:
Switch to Swift
[[[ATAdtagInitializer sharedInstance] configureUrlType:ATUrlTypeProd andLogin:@"__USER__" andPassword:@"__PSWD__" andCompany:@"__COMPANY__"] synchronize];
ATAdtagInitializer.sharedInstance().configureUrlType(__UrlType__, andLogin: "__USER__", andPassword: "__PSWD__", andCompany: "__COMPANY__").synchronize();
The AdtagInitializer permits to configure the access to the various Adtag platforms.
Connecthings gives you access to three platforms :
- The Demo platform is ideal for the technical Proof of Concept (POC) phase
- The Pre-production platform is ideal for the beta versions
- The Production platform is used when you're ready to publish your application
Connecthings sent you two different access keys for each platform:
- An access key to sign in the Adtag Platfrom
- An access key to use with the mobile SDK, called API_KEY. Be sure to use the correct API KEY (login, password, and platform) to connect the SDK to the Adtag Platform, otherwise the application won't detect the beacons.
- Connect your iOS Device to your computer
- Into Xcode, click on "Play" to launch the installation on your phone
- Flash the QR Code received from Connecthings
- A new page is opening (called ResultController) displaying the name of the point associated to the QR Code