AdFit - SPM 설치 방법
AdFit
'AdFit' '3.18.7' 이후 ver 부터 사용 가능합니다.
사용방법
2) 초기 셋팅, 3) 초기화, 4) NativeUI 구성 진행은 링크에 들어가서 직접 설정하시는 것을 권장드립니다.
1) SPM 설치
https://github.com/adfit/adfit-spm.git
2) 초기 셋팅
SKAdNetwork 설정 -> 링크 다음 코드를 사용하여 Info.plist의 SKAdNetworkItems을 직접 추가해 주시고 다음 값들을 넣어 주세요.
ATS(App Transport Security) 설정 -> 링크
iOS 9부터 도입 된 App Transport Security (ATS)는 앱이 HTTPS를 통해서만 네트워크 요청을 하도록 기본설정 되어있습니다. HTTP를 사용하는 광고파트너들의 광고동작를 허용하기 위해, Info.plist 파일에 아래내용을 추가합니다.
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
다운받은 "Mediation Adapter"를 Project에 추가
주의⚠️
@@@.m
파일의 Target membership 이 잘 설정 되어 있는지 확인

"SwiftAdPopcornSSP_ObjectiveC_Header.h" 코드 추가
Mediation Adapter를 사용하기 위해 다음과 같이 추가한 hedaer 파일명을 bridge header 에 추가해주세요.

Native Layout Guide
Native 연동
UI component를 SDK에 매칭
xib를 통해 로드한 UI view를 APAdFitNativeAdRenderer를 사용하여 sdk에 전달한다.
#import <AdPopcornSSP/AdPopcornSSPNativeAd.h>
#import "AdFitAdapter.h"
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
APSSPAdfitNativeAdView *adfitNativeAd =
[[NSBundle mainBundle] loadNibNamed:@"APSSPAdfitNativeAdView" owner:nil options:nil].firstObject;
adfitNativeAd.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 250);
APAdFitNativeAdRenderer *apAdFitNativeAdRenderer = [[APAdFitNativeAdRenderer alloc] init];
apAdFitNativeAdRenderer.useBizBoardTemplate = NO;
apAdFitNativeAdRenderer.adfitNativeAdUIView = adfitNativeAd;
[_adPopcornSSPNativeAd setAdFitRenderer:apAdFitNativeAdRenderer superView:adfitNativeAd];
}
AdFit의 경우 AdPopcornSSP, FAN, FAN Native Banner와 다르게 xib파일을 이용하여 직접 View를 생성한 뒤, 해당 xib 파일을 읽어와 renderer에 전달해 주어야 합니다.
APAdFitNativeAdRenderer
에 adfitNativeAdUIView 와 superView를 세팅 후, setAdFitRenderer:superView:
API를 통해 render와 APSSPAdfitNativeAdView 를 sdk에 최종적으로 전달.
반드시 useBizBoardTemplate을 No로 설정해야 합니다.
BizBoard 연동
AdFit-Bizboard 는 코드 상 BizBoardTemplate을 생성하여, 연동을 진행하면 됩니다.
AdFit BizBoardTemplate 사용 시 아래와 같이 연동을 진행하면 됩니다.
#import <AdPopcornSSP/AdPopcornSSPNativeAd.h>
#import "AdFitAdapter.h"
- (void)viewDidLoad
{
[super viewDidLoad];
APAdFitNativeAdRenderer *apAdFitNativeAdRenderer = [[APAdFitNativeAdRenderer alloc] init];
BizBoardTemplate *bizBoardTemplate = [[BizBoardTemplate alloc] init];
apAdFitNativeAdRenderer.adfitBizBoardTemplate = bizBoardTemplate;
apAdFitNativeAdRenderer.bizBoardInfoIconRightConstant = -16; (물음표 아이콘 커스터마이징)
[_adPopcornSSPNativeAd setAdFitRenderer:apAdFitNativeAdRenderer superView:bizBoardTemplate];
}
APAdFitNativeAdRenderer
에 BizBoardTemplate을 설정 한 뒤, setAdFitRenderer
API를 통해 render와 bizBoardTemplateView(superView)를 세팅합니다.
Last updated
Was this helpful?