接入配置

优质
小牛编辑
132浏览
2023-12-01

为工程添加 AdHub SDK Framework

导入SDK,将AdHubSDK文件夹下所有文件导入到相应的工程中,如需要接入激励视频请联系开发者。

添加必要依赖库以及工程配置

在工程 Target Setting -> Build Phases -> Link Binary With Libraries 中进行添加

  • AddressBook.framework
  • AdSupport.framework
  • AVFoundation.framework
  • CoreMedia.framework
  • CoreTelephony.framework
  • CoreLocation.framework
  • CoreMotion.framework
  • CFNetwork.framework
  • CoreGraphics.framework
  • EventKit.framework
  • GLKit.framework
  • JavaScriptCore.framework
  • MobileCoreServices.framework
  • MediaPlayer.framework
  • MessageUI.framework
  • QuarzCore.framework
  • StoreKit.framework
  • SafariServices.framework
  • SystemConfiguration.framework
  • Security.framework
  • Twitter.framework
  • UIKit.framework
  • WebKit.framework
  • libc++.dylib/tbd
  • libsqlite3.dylib/tbd
  • libz.dylib/tbd
  • libc.dylib/tbd
  • libxml2.tbd
  • libiconv.tbd

在工程 Target Setting -> Build Settings -> Other Linker Flags 项添加 "-ObjC"

设置允许 http 连接

在工程的 Info.plist 文件中,设置 App Transport Security Settings 选项下 Allow Arbitrary Loads 值为 YES,对应 plist 内容为

<key>NSAppTransportSecurity</key> 
<dict> 
    <key>NSAllowsArbitraryLoads</key> 
    <true/> 
</dict>

在工程的 Info.plist 文件中添加如下配置

<dict> 
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>描述清晰,比如推送更精确的信息之类的</string>
    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>描述清晰,比如推送更精确的信息之类的</string>
    <key>NSLocationAlwaysUsageDescription</key>
    <string>描述清晰,比如推送更精确的信息之类的</string>
</dict>

初始化SDK,在程序入口设置 AppID 信息

#import <AdHubSDK/AdHubSDK.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [AdHubSDKManager configureWithApplicationID:@"从 AdHub 申请的 AppID"];
    //...
}

是否开启调试日志,会打印部分错误信息,默认是No。

[AdHubSDKManager openTheAdHubLog];

打包SDK测试

企业账号可直接打包 上线账号请添加下面两个udid 0248802d42e420df7b97bb3bff8642e13be83f59 d3e262153452d013cb49579f231b238105c85f6f