SDK
탭조이의 iOS SDK 참조 문서를 살펴보고 플레이스먼트 요청, 콜백 처리, 광고 콘텐츠 표시 및 핵심 SDK 기능 통합 방법을 알아봅니다.
읽는 시간 2분최근 업데이트: 2일 전
플레이스먼트 요청
먼저 파일 상단에서TJPlacement.h#import <tapjoy tjplacement.h>
TJPlacement *p = [TJPlacement placementWithName:@"Main Menu" delegate:self];
[p requestContent];
콘텐츠 사전 캐싱
최적의 사용자 경험을 제공하려면 사용자에게 해당 콘텐츠가 표시되기 전에 콘텐츠를 요청합니다. 예를 들어 플레이스먼트가 메인 메뉴의 버튼이면 탭조이 연결 호출 성공 직후 애플리케이션이 시작될 때 해당 콘텐츠를 요청할 수 있습니다. 마지막 순간까지 대기하여 콘텐츠를 요청하면 사용자가 콘텐츠가 로드될 때까지 기다리고 로딩 스피너를 보게 될 수 있습니다. 이렇게 하면 광고에서 사용자가 광고와 상호 작용할 가능성이 감소하므로 사용자가 수익을 창출할 가능성 역시 줄어듭니다.TJPlacement 콜백
콘텐츠 요청 상태에 대한 피드백을 받으려면 다음 TJPlacementDelegate 메서드를 구현합니다.- (void)requestDidSucceed:(TJPlacement*)placement{} // Called when the content request returns from the Offerwall servers. Does not necessarily mean that content is available.- (void)requestDidFail:(TJPlacement*)placement error:(NSError*)error{}- (void)contentIsReady:(TJPlacement*)placement{} //This is called when the content is actually available to display.- (void)contentDidAppear:(TJPlacement*)placement{}- (void)contentDidDisappear:(TJPlacement*)placement{}
플레이스먼트 표시
콘텐츠를 실제로 표시하려면 show를 호출합니다.[p showContentWithViewController: nil];
showContentWithViewControllershowContentWithViewControllerif (p.isContentReady) { [p showContentWithViewController: nil];} else { //handle situation where there is no content to show, or it has not yet downloaded.}
p.isContentReady콘텐츠 다시 요청
플레이스먼트에서 사용자에게 콘텐츠를 성공적으로 표시할 경우 다른 콘텐츠 단위로 플레이스먼트를 ‘재로드’하려면 콘텐츠를 다시 요청해야 합니다(예:[p requestContent];[p showContentWithViewController: self];탭조이 콘텐츠 액션 요청 처리
보상과 IAP Promo 등의 일부 탭조이 콘텐츠 유형에서는 해당 콘텐츠 단위가 전달한 파라미터에 따라 코드를 통해 조치를 취해야 합니다. 예를 들어 보상 콘텐츠 단위는 사용자에게 지정할 항목 이름(문자열)과 수량(정수)을 지정합니다. 애플리케이션에서는 보상을 반영하도록 사용자의 인벤토리를 실제로 조정해야 합니다. 다음 TJActionRequestDelegate 메서드가 호출되고 콘텐츠 단위에서 적절한 정보로 전달됩니다.- (void)placement:(TJPlacement*)placement didRequestPurchase:(TJActionRequest*)request productId:(NSString*)productId { //called when user clicks the product link in IAP promotion content //implement code here to trigger IAP purchase flow for item here}- (void)placement:(TJPlacement*)placement didRequestReward:(TJActionRequest*)request itemId:(NSString*)itemId quantity:(int)quantity { //called when the reward content is closed by the user //implement code here to give the player copies of item}
엔트리 포인트 설정
필요에 따라 각 플레이스먼트의 ‘엔트리 포인트’를 탭조이에 제공할 수 있습니다. 선택 가능한 다양한 프리셋 값은 다음과 같습니다.TJEntryPointUnknown //Not set, but removes any value that was already setTJEntryPointOtherTJEntryPointMainMenuTJEntryPointHudTJEntryPointExitTJEntryPointFailTJEntryPointCompleteTJEntryPointInboxTJEntryPointInitialisationTJEntryPointStore
TJPlacement *placement = [TJPlacement placementWithName:@"myPlacement" delegate:nil];[placement setEntryPoint:TJEntryPointMainMenu];[placement requestContent];