初始化 iOS 版 Audience Network SDK

iOS Audience Network SDK 必須明確初始化。

在您成功設定 SDK 之後,必須初始化 SDK。

  1. 開啟專案檔案(如果您是使用 CocoaPods,則開啟工作空間)
  2. 在您的應用程式委派中加入下列程式碼片段
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

	FBAudienceNetworkAds.initialize(with: nil, completionHandler: nil)

	// Pass user's consent after acquiring it. For sample app purposes, this is set to YES.
	FBAdSettings.setAdvertiserTrackingEnabled(true)

	// Your app initialization logic goes here...
	return true
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary<NSString *, id> *)launchOptions
{
[FBAudienceNetworkAds initializeWithSettings:nil completionHandler:nil];

// Pass user's consent after acquiring it. For sample app purposes, this is set to YES.
[FBAdSettings setAdvertiserTrackingEnabled:YES];

// Your app initialization logic goes here...

return YES;
}