iOS SDK >
Cloud Planar Marker

Welcome to the Cloud planar marker tutorial. You will learn how to set up the Pikkart SDK in your app so that it will recognize markers whose definition is not stored locally in the device, but on the cloud.
The tutorial is heavily based on the Local Planar marker one, therefore it is advised that you get acquainted with it before reading this.

Note: Our SDK is designed for use with Xcode (versions 8.2+) and supports iOS SDK 10.2+. The code below is compliant with the Swift 4.0 programming language. 
A complete Xcode project can be downloaded from github. The following explanations are based on the code found there.
An important thing to know for people who wish to use the demo license, is that since you are limited to one bundle identifier for your apps (com.pikkart.trial) it is advisable to delete any app created with the Pikkart SDK before installing a new one.

Before you can run this example, you need to do the following:

  1. Decompress the SDK zip file you downloaded from the Pikkart developer site and, from there, copy the pikkartAR.framework file in your Xcode project directory. Add it to the project as an existing file.
  2. Go to the "General" tab to add a few items to the "Linked Frameworks and Libraries" section:          Note: only the pikkartAR.framework file is provided in the zip file, all the other frameworks are already included with XCode.
  3. Set a wildcard provisioning profile (important!) and your own team / signing certificate into the project.
  4. Provide your own SDK license, adding it to the project directory and main group
  5. Follow this link to create your own cloud based marker that we will use to recognize the 001_small.jpg image included in this example. Please remember to use this file when uploading an image for the marker.

We need now to change the way recognition is started. In order to do that, three things need to be changed from the Local Planar Marker tutorial:

  • You need to input the database name you created in step 4. right here:
    let authInfo:PKTCloudRecognitionInfo = PKTCloudRecognitionInfo(databaseName: "<Database name>")
  • The PKTRecognitionOptions need to be changed as follows:
    let options:PKTRecognitionOptions = PKTRecognitionOptions(recognitionStorage:.PKTGLOBAL, andMode: .PKTRECOGNITION_TAP_TO_SCAN, andCloudAuthInfo:authInfo )
     To allow a better control on the number on cloud recognition calls, when Pikkart's AR SDK is set to GLOBAL marker search it only works in TAP_TO_SCAN mode. This way each call to the startRecognition method fires off a single, small burst of calls to Pikkart's cloud recognition service. 
  • In the glkView function we need to provide the correct marker id in place of the default "3_2010", in the line that reads:
    if (currentMarker.markerId! == "3_2010") {

The final result should be similar to this:

And you should see some log messages in the console whenever the camera frames/loses the marker.

Success!