2929
3030### 更新记录:
3131
32+ * 2017.11.22 -- v3.9.0 -->1.新增部分代理方法,部分旧的代理方法做过期处理,2.几处优化...
3233* 2017.11.14 -- v3.8.4 -->1.版本优化,2.bug fix...
3334* 2017.10.18 -- v3.8.0 -->1.增加对LaunchScreen.storyboard支持,2.修复pod导入编译报错问题...
3435* 2017.10.11 -- v3.7.1 -->1.批量缓存接口增加结果回调...
8081 XHLaunchImageAdConfiguration *imageAdconfiguration = [XHLaunchImageAdConfiguration defaultConfiguration];
8182 //广告图片URLString/或本地图片名(.jpg/.gif请带上后缀)
8283 imageAdconfiguration.imageNameOrURLString = @"image0.jpg";
83- //广告点击打开链接
84- imageAdconfiguration.openURLString = @"http://www.it7090.com";
84+ //广告点击打开页面参数(openModel可为NSString,模型,字典等任意类型)
85+ imageAdconfiguration.openModel = @"http://www.it7090.com";
8586 //显示图片开屏广告
8687 [XHLaunchAd imageAdWithImageAdConfiguration:imageAdconfiguration delegate:self];
8788```
107108 imageAdconfiguration.imageOption = XHLaunchAdImageRefreshCached;
108109 //图片填充模式
109110 imageAdconfiguration.contentMode = UIViewContentModeScaleToFill;
110- //广告点击打开链接
111- imageAdconfiguration.openURLString = @"http://www.it7090.com";
111+ //广告点击打开页面参数(openModel可为NSString,模型,字典等任意类型)
112+ imageAdconfiguration.openModel = @"http://www.it7090.com";
112113 //广告显示完成动画
113114 imageAdconfiguration.showFinishAnimate =ShowFinishAnimateFadein;
114115 //广告显示完成动画时间
150151 XHLaunchImageAdConfiguration *imageAdconfiguration = [XHLaunchImageAdConfiguration defaultConfiguration];
151152 //广告图片URLString/或本地图片名(.jpg/.gif请带上后缀)
152153 imageAdconfiguration.imageNameOrURLString = model.content;
153- //广告点击打开链接
154- imageAdconfiguration.openURLString = model.openUrl;
154+ //广告点击打开页面参数(openModel可为NSString,模型,字典等任意类型)
155+ imageAdconfiguration.openModel = model.openUrl;
155156 //显示开屏广告
156157 [XHLaunchAd imageAdWithImageAdConfiguration:imageAdconfiguration delegate:self];
157158
195196 imageAdconfiguration.imageOption = XHLaunchAdImageDefault;
196197 //图片填充模式
197198 imageAdconfiguration.contentMode = UIViewContentModeScaleToFill;
198- //广告点击打开链接
199- imageAdconfiguration.openURLString = model.openUrl;
199+ //广告点击打开页面参数(openModel可为NSString,模型,字典等任意类型)
200+ imageAdconfiguration.openModel = model.openUrl;
200201 //广告显示完成动画
201202 imageAdconfiguration.showFinishAnimate =ShowFinishAnimateLite;
202203 //广告显示完成动画时间
229230 XHLaunchVideoAdConfiguration *videoAdconfiguration = [XHLaunchVideoAdConfiguration defaultConfiguration];
230231 //广告视频URLString/或本地视频名(请带上后缀)
231232 videoAdconfiguration.videoNameOrURLString = @"video0.mp4";
232- //广告点击打开链接
233- videoAdconfiguration.openURLString = @"http://www.it7090.com";
233+ //广告点击打开页面参数(openModel可为NSString,模型,字典等任意类型)
234+ videoAdconfiguration.openModel = @"http://www.it7090.com";
234235 //显示视频开屏广告
235236 [XHLaunchAd videoAdWithVideoAdConfiguration:videoAdconfiguration delegate:self];
236237```
254255 videoAdconfiguration.scalingMode = MPMovieScalingModeAspectFill;
255256 //是否只循环播放一次
256257 videoAdconfiguration.videoCycleOnce = NO;
257- //广告点击打开链接
258- videoAdconfiguration.openURLString = @"http://www.it7090.com";
258+ //广告点击打开页面参数(openModel可为NSString,模型,字典等任意类型)
259+ videoAdconfiguration.openModel = @"http://www.it7090.com";
259260 //广告显示完成动画
260261 videoAdconfiguration.showFinishAnimate =ShowFinishAnimateFadein;
261262 //广告显示完成动画时间
298299 XHLaunchVideoAdConfiguration *videoAdconfiguration = [XHLaunchVideoAdConfiguration defaultConfiguration];
299300 //注意:视频广告只支持先缓存,下次显示(看效果请二次运行)
300301 videoAdconfiguration.videoNameOrURLString = model.content;
301- //广告点击打开链接
302- videoAdconfiguration.openURLString = model.openUrl;
302+ //广告点击打开页面参数(openModel可为NSString,模型,字典等任意类型)
303+ videoAdconfiguration.openModel = model.openUrl;
303304 [XHLaunchAd videoAdWithVideoAdConfiguration:videoAdconfiguration delegate:self];
304305
305306 } failure:^(NSError *error) {
341342 videoAdconfiguration.scalingMode = MPMovieScalingModeAspectFill;
342343 //是否只循环播放一次
343344 videoAdconfiguration.videoCycleOnce = NO;
344- //广告点击打开链接
345- videoAdconfiguration.openURLString = model.openUrl;
345+ //广告点击打开页面参数(openModel可为NSString,模型,字典等任意类型)
346+ videoAdconfiguration.openModel = model.openUrl;
346347 //广告显示完成动画
347348 videoAdconfiguration.showFinishAnimate =ShowFinishAnimateFadein;
348349 //广告显示完成动画时间
@@ -408,16 +409,25 @@ typedef NS_ENUM(NSInteger,SkipType) {
408409
409410### 2.点击事件
410411``` objc
412+
411413/* *
412- * 广告点击事件 回调
413- */
414- - (void )xhLaunchAd:(XHLaunchAd *)launchAd clickAndOpenURLString:(NSString *)openURLString;
415- {
414+ 广告点击事件回调
415+ */
416+ -(void )xhLaunchAd:(XHLaunchAd *)launchAd clickAndOpenModel:(id )openModel clickPoint:(CGPoint)clickPoint{
417+
418+ NSLog(@"广告点击事件");
419+
420+ /**
421+ openModel即配置广告数据设置的点击广告时打开页面参数
422+ */
423+ NSString *urlString = (NSString *)openModel;
416424
417- //跳转到广告详情页面,详见demo
418- WebViewController *VC = [[WebViewController alloc] init];
419- VC.URLString = openURLString;
420- .....
425+ //此处跳转页面
426+ //WebViewController *VC = [[WebViewController alloc] init];
427+ //VC.URLString = urlString;
428+ ////此处不要直接取keyWindow
429+ //UIViewController* rootVC = [[UIApplication sharedApplication].delegate window].rootViewController;
430+ //[rootVC.myNavigationController pushViewController:VC animated:YES];
421431
422432}
423433
@@ -612,7 +622,7 @@ configuration.customSkipView = [self customSkipView];
612622}
613623
614624/* *
615- 如果你想用SDWebImage等框架加载网络广告图片,请实现此代理
625+ 如果你想用SDWebImage等框架加载网络广告图片,请实现此代理(注意:实现此方法后,图片缓存将不受XHLaunchAd管理)
616626
617627 @param launchAd XHLaunchAd
618628 @param launchAdImageView launchAdImageView
@@ -626,6 +636,18 @@ configuration.customSkipView = [self customSkipView];
626636
627637```
628638
639+ ## 常见问题
640+ #### 1.为什么设置了本地图片广告,却提示找不到图片资源?
641+ * 请将本地广告图片,直接放在工程目录,不要放在Assets里面,XHLaunchAd不是通过imageName:读取图片,而是是通过[ NSBundle mainBundle] path....的方式读取本地图片的(此处涉及到内存优化)
642+
643+ #### 2.为什么我启动的时候会先进入根控制器后,再显示广告页面?
644+ * 请确认下,你在请求广告数据之前,是否有调用` [XHLaunchAd setWaitDataDuration:3]; ` 方法设置数据等待时间
645+
646+ #### 3.为什么有时候我会卡在启动广告页面(偶现)?
647+ * 此情况多出现在网络环境差时,请检查你程序启动时,有没有掉用同步方法或同步请求,(例如:环信SDK同步登录等),
648+ * XHLaunchAd采用GCD定时器,不受主线程阻塞影响,但是GCD倒计时到后,广告移除实在主线程中进行的.
649+
650+
629651## 依赖
630652#### 1.本库依赖于: FLAnimatedImage
631653
0 commit comments