Import & configure SDK

更新时间:
复制 MD 格式

Import and configure the QuickTracking iOS SDK in your app using CocoaPods or manual integration.

SDK basic information

SDK name

Version number

MD5 value

Package name

Package size

QuickTracking iOS SDK

Latest version: 1.8.7

Update log: iOS SDK update log

1c5b648b94afb965a0de5c1145d47ba7

com.quicktracking.sdk.ios.QTCommon

6.9 MB

1 Quick integration

The QuickTracking console generates a dedicated integration code for each app. Follow the in-product guidance to integrate it. If you are already using the Umeng+ SDK, you must change the SDK file path immediately. For details, see section 1.6 of this document.

1.1 Go to the product consoleimage.png

1.2 Find the application's organizationimage.png

1.3 Find your appimage

1.4 Click “Integrate”image

1.5 Get your dedicated integration code

image

1.6 Check for conflicts with Umeng+ SDK

If you are already using the Umeng+ SDK, change the SDK file path before integrating.

Important

To change the SDK file path:

  • If you have already integrated Umeng+ SDK and now need to integrate QT SDK: Add [QTConfigure resetStorePath] before all QT and Umeng+ code (at least before setting the data collection domain).

  • If you have already integrated QT SDK and now need to integrate Umeng+ SDK: Add [UMConfigure resetStorePath] before all QT and Umeng+ code (at least before setting the data collection domain).

If you do not follow this logic, both Umeng+ SDK and QT SDK will share the same storage path, causing log confusion. The rule is: whichever SDK initializes first, reset the file path of the other SDK. For example, if Umeng+ SDK initializes first, call [QTConfigure resetStorePath]. If QT SDK initializes first, call [UMConfigure resetStorePath].

Note: If you reset the QT SDK path, keys used to store feature information such as user account and app version will change. If your business logic depends on these fields, reconfigure them. We strongly recommend configuring this during initial integration to avoid data loss.

2 Integration code details

If you cannot access the console page, use the following code to integrate manually:

2.1 Prepare parameters

appkey: Get it from the application list.

Data collection domain: Get it from the “Management Console > Collect Information” module.

2.2 Import SDK

Run the pod setup command in your terminal. Pulling the latest CocoaPods repository may take a while.

$ pod setup

CocoaPods lets you configure the required SDKs. For example, if your project target is named “QuickTrackingDemo”, add the following to your Podfile in the project root directory:

target 'QuickTrackingDemo' do     
pod '<Quick Tracking SDK name>' 
end

Note: Because pod search may fail to find newly added pods, we recommend using pod update directly.

Quick Tracking base libraries

// QuickTracking analytics SDK
pod 'QTCommon'
 
// Add QTCommonLog from “Base Libraries > Logstore” for development and debugging.
pod 'QTCommonLog'

Note: QTCommonLog is for debugging the SDK and related features during development. Remove it before publishing your app.

2.3 Manual integration

Dependency libraries:

CoreTelephony.framework    Get carrier identifier
    
libz.tbd  Data compression
    
libsqlite3.tbd  Data caching
     
SystemConfiguration.framework  Detect network status

libc++.tbd   C++ standard library

Project configuration:

  1. Select the SDK components you need and download them. Unzip the .zip file to get the component packages (for example: QTCommon.framework).

  2. In Xcode, choose File —> Add Files to "Your Project". In the dialog that appears, select the downloaded component package and click Add. (Note: Select “Copy items if needed.”)image

  3. Add dependency libraries. In your project settings, go to target —> General tab —> Linked Frameworks and Libraries.

    As shown below:1615343052184-db860bef-a753-494f-92da-243a8c136b2d

  4. In Targets —> Build Settings, add -ObjC to Other Linker Flags. You must add this flag. Note that the C must be uppercase, not lowercase.

2.4 Import header files

#import <QTCommon/QTCommon.h>
#import <UMCommonLog/UMCommonLogManager.h> // Required only if you import the logging package

3 Tracking validation configuration

Add a URL Scheme to your project under target > Info tab > URL Types. Enter the scheme: atm.yourappkey. Call [QTMobClick handleUrl:url] in AppDelegate to receive the URL.

AppDelegate call:

- (BOOL)application:(UIApplication *)application openURL:(nonnull NSURL *)url options:(nonnull NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
    if ([QTMobClick handleUrl:url]) {
        
      return YES;
    }

    return YES;
}

SceneDelegate call:

- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {

    for (UIOpenURLContext *context in connectionOptions.URLContexts) {
        [QTMobClick handleUrl:context.URL];
    }
}

- (void)scene:(UIScene *)scene openURLContexts:(NSSet<UIOpenURLContext *> *)URLContexts {

    [QTMobClick handleUrl:URLContexts.allObjects.firstObject.URL];
}

4 App Store submission notes

Your app’s privacy policy must clearly state: - The types of data collected by QuickTracking SDK and their purposes (such as device identifiers and usage behavior). - How users can revoke tracking authorization (via System Settings > Privacy > Tracking to disable permissions).

4.1 IDFA notes

  1. The Quick Tracking SDK collects the IDFA by default to enable more accurate data analysis and verification. If your app does not otherwise collect IDFA, configure your App Store submission as follows to avoid rejection by Apple for “collecting IDFA without advertising functionality.”1612266822165-29c8614c-00ce-4dd0-958e-76f02754d244

  2. Quick Tracking SDK does not request IDFA permission on its own. If your app does not request it, no permission prompt appears. You must configure IDFA permission requests in your app.

  3. If users decline IDFA collection, set a custom field or return an empty string. For details, see: 2.1 Device ID settings. This prevents Quick Tracking SDK from collecting IDFA.

4.2 App Tracking Transparency notes

To comply with Apple’s privacy policies, apps using QuickTracking SDK must request user authorization for tracking through Apple’s App Tracking Transparency (ATT) framework.

Configuration steps

  1. Info.plist configuration Add the NSUserTrackingUsageDescription key to your app’s Info.plist file, along with a user-friendly description:

    xml
    
    <!-- Add ATT permission description -->
    <key>NSUserTrackingUsageDescription</key>
    <string>To deliver more relevant ads and improve your service experience, we need your permission to track your activity.</string>
  2. When to request authorization Request ATT permission when your app launches or just before using tracking-related features. Avoid requesting it immediately at cold start to improve user acceptance rates.

  3. Code example

    #import <AppTrackingTransparency/AppTrackingTransparency.h>
    #import <AdSupport/AdSupport.h>
    #import <QTCommon/QTCommon.h>
    
    - (void)requestTrackingPermission {
        if (@available(iOS 14, *)) {
            [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
                if (!(status == ATTrackingManagerAuthorizationStatusAuthorized)) {
                    {
                        [QTConfigure customSetIdfaBlock:^NSString *{
                            return @"Enter your custom IDFA";
                        }];
                    }
                }
            }];
        }
    }