네이티브 Side 연동(iOS)
1. Handler 생성
#import "AdPopcornSSPWKScriptMessageHandler.h"
@interface AdPopcornSSPController() <WKNavigationDelegate, WKUIDelegate>
{
}
@implementation AdPopcornSSPController
- (void)viewDidLoad {
webViewConfiguration = [[WKWebViewConfiguration alloc] init];
wkContentController = [[WKUserContentController alloc] init];
AdPopcornSSPWKScriptMessageHandler *scriptMessageHandler = [[AdPopcornSSPWKScriptMessageHandler alloc] initWithDelegate:nil];
[wkContentController addScriptMessageHandler:scriptMessageHandler name:@"apssp"];
[webViewConfiguration setUserContentController:wkContentController];
webView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) configuration:webViewConfiguration];
scriptMessageHandler.webView = webView;
webView.navigationDelegate = self;
webView.uiDelegate = self;
}2. webView 객체 설정
3. 델리게이트 설정
마지막 업데이트