# 디버깅

* 연동 과정에서 디버깅을 필요하다면, 아래와 같이 코드를 적용하여 '\[ADPIE]'를 포함하는 텍스트를 검색하여 로그 메시지를 확인합니다.

{% tabs %}
{% tab title="Swift" %}

```swift
import UIKit
import AdPieSDK
import AppTrackingTransparency

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow?
    func application(_ application: UIApplication, 
        didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool 
    {
        return true
    }

    func applicationDidBecomeActive(_ application: UIApplication) {

        func initializeSDK() {
            // 디버깅 적용
            AdPieSDK.sharedInstance().logging()
            // SDK 초기화
            AdPieSDK.sharedInstance().initWithMediaId("YOUR_MEDIA_ID")
        }
    
        if #available(iOS 14.5, *) {
            ATTrackingManager.requestTrackingAuthorization { _ in
                initializeSDK()
            }
        } else {
            initializeSDK()
        }
    }
}
```

{% endtab %}

{% tab title="Objective-C" %}

```objectivec
// AppDelegate.m
#import "AppDelegate.h"
#import <AdPieSDK/AdPieSDK.h>
#import <AppTrackingTransparency/AppTrackingTransparency.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application 
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{
    return YES;
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    if (@available(iOS 14.5, *)) {
        [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(_){
            [self initializeSDK];
        }];
    } else {
        [self initializeSDK];
    }
}

- (void)initializeSDK {
    // 디버깅 적용
    [[AdPieSDK sharedInstance] logging];
    // SDK 초기화
    [[AdPieSDK sharedInstance] initWithMediaId:@"YOUR_MEDIA_ID_HERE"];
}

@end
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://platform-business.gitbook.io/adpie/ios/common/debug.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
