「IDGraph iOS Tracking Code」修訂間的差異

出自TAMedia
跳至導覽 跳至搜尋
imported>Wikiuser
imported>Wikiuser
 
(未顯示同一使用者於中間所作的 3 次修訂)
行 3: 行 3:
請參考以下範例
請參考以下範例


== Objective-c ==
== Objective-C ==
在AppDelegate.m內加入#import <TAMIdGraph/TAMIdGraph.h>
在AppDelegate.m內加入#import <TAMIdGraph/TAMIdGraph.h>
     #import <TAMIdGraph/TAMIdGraph.h>
     #import <TAMIdGraph/TAMIdGraph.h>
行 12: 行 12:
      
      
     - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
     - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
         [TAMIdGraphManager setDebugMode:NO];//設YES用來顯示log,Production版本 default 為NO
         [TAMIdGraphManager setDebugMode:NO];//設YES用來顯示log, default 為NO
         [TAMIdGraphManager initTAMIdGraphManagerWithServiceId:@"Your service id"];
         [TAMIdGraphManager initTAMIdGraphManagerWithServiceId:@"Your service id"];
         return YES;
         return YES;
     }
     }


 
完成以上步驟即完成追蹤碼的設置
完成上續步驟即完成追蹤碼的建置


== Swift ==
== Swift ==
行 35: 行 34:
             return true
             return true
         }
         }
 
    }
[[IDGraph_iOS_SDK_Developer_Guide|回IDGraph iOS guide]]
[[IDGraph_iOS_SDK_Developer_Guide|回IDGraph iOS guide]]

於 2019年5月31日 (五) 03:22 的最新修訂

在AppDelegate的didFinishLaunchingWithOptions function中,帶入Service id初始化TAMIdGraphManager即可完成追蹤碼的建置。
其中Service id就是TAMedia提供給您的服務id。
請參考以下範例

Objective-C

在AppDelegate.m內加入#import <TAMIdGraph/TAMIdGraph.h>

   #import <TAMIdGraph/TAMIdGraph.h>
   @interface AppDelegate ()
   @end
    
   @implementation AppDelegate
    
   - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
       [TAMIdGraphManager setDebugMode:NO];//設YES用來顯示log, default 為NO
       [TAMIdGraphManager initTAMIdGraphManagerWithServiceId:@"Your service id"];
       return YES;
   }

完成以上步驟即完成追蹤碼的設置

Swift

在YourProjectName-Bridging-Header.h內加入

   #import <TAMIdGraph/TAMIdGraph.h>

在AppDelegate.swift內實作

   import UIKit
   import TAMIdGraph
    
   @UIApplicationMain
    
   class AppDelegate: UIResponder, UIApplicationDelegate {
       var window: UIWindow?
       func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
           TAMIdGraphManager.initTAMIdGraphManager(withServiceId:"Your Service Id")      
           return true
       }
   }

回IDGraph iOS guide