Coder Social home page Coder Social logo

coderzhuxh / xhlaunchad Goto Github PK

View Code? Open in Web Editor NEW
3.7K 81.0 734.0 38.67 MB

🔥The screen opening advertising solutions - 开屏广告、启动广告解决方案-支持静态/动态图片广告,mp4视频广告,全屏/半屏广告、兼容iPhone/iPad. 【 Github下载不了/下载慢 可以访问国内下载地址: https://gitee.com/CoderZhuXH/XHLaunchAd】

License: MIT License

Objective-C 99.66% Ruby 0.34%
objective-c ios pod iphone podfile apple ipad

xhlaunchad's Issues

图片缓存备份问题

你好,刚刚阅读了您的源码,有一点不理解,请教一下。
你缓存的图片 存在于Library/XHLaunchAdCache 目录下,这个目录会被icloud 备份的吧?这是你设计如此,还说没有做这方面的考虑呢?

bug: 设置skipType类型为SkipTypeNone无效

设置skipType为SkipTypeNone,跳过、读秒依然存在。通过阅读源码,发现是
image这句判断有误。建议修改为:
BOOL isSetSkipType = _skipType!= SkipTypeNone || _skipType!= SkipTypeTime || _skipType != SkipTypeText || _skipType!= SkipTypeTimeText; if(!isSetSkipType) _skipType = SkipTypeTimeText;

点击跳过BUG

点击跳过进入VC ,倒数秒到了会再进入一次VC

能增加后台缓存图片?

能不能增加这种功能?
第一次运行时预先在后台缓存好图片,因为网速不好的话图片加载会比较慢。

建议

请问,是否可增加一个几秒内图片未下载完成,跳转到rootViewController,而不是直接开始计数

开屏广告是加在keyWindow上的,如果创建一个新的window用于放置开屏广告会更好

直接加在keyWindow会对于集成造成一些不是太友好的影响,因为我们公司的项目,对于keyWidow有他自己的业务逻辑了,这样会造成一定的侵入。
其实大家一般盖视图,习惯在 KeyWindow 上直接AddSubview, 其实这是不好的。首先KeyWindow 会被AlertView覆盖, 还有可能别的业务代码也进行了AddSubview 这样就会把你的广告给覆盖了

缓存的问题

伙计,启动的时候加载的广告图片,不应该都缓存吧,如果我每天更新广告URL,那么会使手机缓存增加的,这个问题你怎么处理?我觉得只需要缓存一张广告就行了,更新了替换掉原来的图片就行了,不应该是都缓存,你觉得呢?

崩溃

iPad 和 pro真机测试就崩溃,模拟器就不会,lunchImage也有,会崩溃在 UIViewController *LaunchScreenSb = [[UIStoryboard storyboardWithName:UILaunchStoryboardName bundle:nil] instantiateInitialViewController]

广告结束后window上覆盖了一层view

在结束广告之后,window上被覆盖了一层view,导致根视图所有的东西都无法点击.我尝试找了找,没有找到这个view的意义,也没有找到位置,但找到了治标不治本的解决方案.
image
解决方案就是干掉这个view呗,用作者给的协议.
image

崩溃

-[XHLaunchAd .cxx_destruct],请问这个什么原因?

第四种缓存机制有问题

后台缓存本次不显示,缓存OK后下次再显示,这种缓存机制,没有显示图片,但是却显示了倒计时

初始化的图片类型,出现视频问题

这是我写的初始化代码

#pragma mark- 开屏广告相关
-(void)setupXHLaunchAd
{
    AdImage *item = [AdImage searchSingleWithWhere:nil orderBy:nil];
    
    if (item != nil) {
        //1.因为数据请求是异步的,请在数据请求前,调用下面方法配置数据等待时间.
        //2.设为3即表示:启动页将停留3s等待服务器返回广告数据,3s内等到广告数据,将正常显示广告,否则将自动进入window的RootVC
        //3.数据获取成功,初始化广告时,自动结束等待,显示广告
        [XHLaunchAd setWaitDataDuration:3];//请求广告数据前,必须设置
        
        //配置广告数据
        XHLaunchImageAdConfiguration *imageAdconfiguration = [XHLaunchImageAdConfiguration new];
        imageAdconfiguration.duration = item.show_time;

        //imageAdconfiguration.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.width/model.width*model.height);
        imageAdconfiguration.imageNameOrURLString = [NSString linkUrl:item.imgurl];
        imageAdconfiguration.imageOption = XHLaunchAdImageDefault;
        imageAdconfiguration.contentMode = UIViewContentModeScaleToFill;
        imageAdconfiguration.openURLString = item.link_id;
        imageAdconfiguration.showFinishAnimate =ShowFinishAnimateFadein;
        imageAdconfiguration.skipButtonType = SkipTypeTimeText;
        imageAdconfiguration.showEnterForeground = NO;
        
        [XHLaunchAd imageAdWithImageAdConfiguration:imageAdconfiguration delegate:self];
    }
    
    //重新下载广告数据
    [[APIClient sharedClient] startImgsWithTag:self call:^(AdImage *item, APIObject *info) { }];
    
}

以下是检测到的卡顿信息。我在初始化时没有使用视频方式,使用的图片,但卡顿出现了视频信息

libsystem_kernel.dylib	semaphore_wait_trap + 8
1 libdispatch.dylib	__dispatch_semaphore_wait_slow + 191
2 HomeSharing	-[HSCloudClient canShowCloudMusic] + 347
3 MediaPlayer	-[MPMediaLibraryDataProviderML3 systemFilterPredicatesWithGroupingType:cloudTrackFilteringType:subscriptionFilteringOptions:] + 339
4 MediaPlayer	-[MPMediaLibraryDataProviderML3 ML3SystemFilterPredicatesWithGroupingType:cloudTrackFilteringType:subscriptionFilteringOptions:additionalFilterPredicates:] + 95
5 MediaPlayer	-[MPMediaLibraryDataProviderML3 setLibraryEntityFilterPredicatesWithCloudFilteringType:additionalFilterPredicates:] + 55
6 MediaPlayer	-[MPMediaLibrary setLibraryFilterPredicates] + 165
7 MediaPlayer	-[MPMediaLibrary init] + 723
8 MediaPlayer	___36+[MPMediaLibrary deviceMediaLibrary]_block_invoke + 67
9 libdispatch.dylib	__dispatch_client_callout + 23
10 libdispatch.dylib	__dispatch_barrier_sync_f_invoke + 57
11 MediaPlayer	+[MPMediaLibrary deviceMediaLibrary] + 31
12 MediaPlayer	+[MPMediaLibrary defaultMediaLibrary] + 221
13 MediaPlayer	-[MPAVController preferredLanguages] + 89
14 MediaPlayer	-[MPAVController _connectAVPlayer] + 1019
15 MediaPlayer	___37-[MPAVController setPlaylistManager:]_block_invoke + 163
16 MediaPlayer	MPLogActivity + 70
17 MediaPlayer	-[MPAVController setPlaylistManager:] + 127
18 MediaPlayer	-[MPAVController _playlistManager] + 111
19 MediaPlayer	-[MPAVController _setActionAtEndAttributeForState:] + 73
20 MediaPlayer	-[MPMoviePlayerControllerNew init] + 299
21 MediaPlayer	-[MPMoviePlayerController initWithContentURL:] + 189
22 FaceCard	0x00066000 + 2721971
23 FaceCard	0x00066000 + 2721733
24 FaceCard	0x00066000 + 2701609
25 FaceCard	0x00066000 + 2705805
26 UIKit	-[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 541
27 UIKit	-[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 205
28 UIKit	-[UIViewAnimationState animationDidStop:finished:] + 79
29 QuartzCore	CA::Layer::run_animation_callbacks(void*) + 253
30 libdispatch.dylib	__dispatch_client_callout + 23
31 libdispatch.dylib	__dispatch_main_queue_callback_4CF$VARIANT$mp + 1525
32 CoreFoundation	___CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
33 CoreFoundation	___CFRunLoopRun + 1575
34 CoreFoundation	CFRunLoopRunSpecific + 520
35 CoreFoundation	CFRunLoopRunInMode + 108
36 GraphicsServices	GSEventRunModal + 160
37 UIKit	UIApplicationMain + 144
38 FaceCard	0x00066000 + 1030341

请看

网络请求下来关于广告的url,此时你就开始倒计时出现广告了,但是网络慢的情况下,是个白板,还没有加载出来图片,但是倒计时已经开始了
我设置时长是5s,很多时候都是倒计时到3s的时候才出来广告图片

是不是应该监测图片加载不下来,就不开始倒计时,知道图片开始展示出来才开始倒计时

如果app支持landscape的话,好像启动画面显示不出来

如果app的device orientation是Landscape left/right的,Launch Image source是竖屏显示的,但是用以下的代码显示不出来广告,广告的数据源是肯定没问题的。
XHLaunchImageAdConfiguration *imageAdconfiguration = [XHLaunchImageAdConfiguration defaultConfiguration];
imageAdconfiguration.duration=6;
imageAdconfiguration.imageNameOrURLString = @“图片的源”;
imageAdconfiguration.openURLString = @“链接的源”;
//显示图片开屏广告
[XHLaunchAd imageAdWithImageAdConfiguration:imageAdconfiguration delegate:self];

个别崩溃情况

上架后有个别用户发生闪退在:-(void)startSkipDispathTimer
if(duration == 0) {
dispatch_source_cancel(_skipTimer);这里

用了友盟的统计,不知道是不是有冲突
default

applicationDidBecomeActive写到这里,会闪

怎么写到这里会闪呢??
本意是自已写一个时间进去,
大于某一个时间,就显示广告.
因为好多用户打开APP后,是不会主动关的.
如果写在didFinishLaunchingWithOptions里边,真不好说他几天才能看到一次.
但写到applicationDidBecomeActive里边,
后闪launchImage这个图.
applicationWillEnterForeground这里我也试了.都一样

另外,总是会显示不默认设置的launchImage的图.
这个能不能在已经有广告图时,就不再显示了??
或者我哪设的不对??

点击查看详情返回后倒计时 还存在

在demo中使用 xcode8 ios10运行项目,进入广告详情,在点击关闭,还是存在倒计时,有什么方法可以在进入详情后关闭详情页 直接进入 主页面吗?

总是崩溃,不知道啥原因了

2016-11-07 01:21:22.248 chu[91598:15125509] -[XHLaunchAd viewControllers]: unrecognized selector sent to instance 0x7f9b74d79060
2016-11-07 01:21:22.310 chu[91598:15125509] NSScanner: nil string argument
2016-11-07 01:21:22.311 chu[91598:15125509] NSScanner: nil string argument
libc++abi.dylib: terminate_handler unexpectedly threw an exception

用的UITabBarController
但也没有啥特别设置呀.

swift的写法要求

能够展示swift语法的写法吗?
因为我是用swift写然后import objective-c来用的
因为我不太会objective-c所以不会翻译至swift
T.T拜托你了,大大
谢谢你先~~~

screen shot 2016-11-02 at 6 29 52 pm

adImgView懒加载方法,没设置contentmode

-(UIImageView *)adImgView
{
    if(_adImgView==nil)
    {
        _adImgView = [[UIImageView alloc] initWithFrame:_adFrame];
        _adImgView.userInteractionEnabled = YES;
        _adImgView.alpha = 0.2;
        _adImgView.contentMode = UIViewContentModeScaleAspectFill;  // -->newly
        _adImgView.clipsToBounds = YES;  // -->newly
        UITapGestureRecognizer* tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)];
        [_adImgView addGestureRecognizer:tap];
    }
    return _adImgView;
}

当然,这不算是什么issue哈,只是个人比较习惯这样,不然某些图片被缩放变形了,看着怪怪的

persent到web页面,dismiss后发现倒计时还在

点击广告页进入一个h5页面后,回来发现倒计时还是刚刚那秒数 按道理说 如果dismiss掉h5后 时间已经过了设置的秒数 应该自动跳过,而不是timer还在那一直等待吧~

启动闪退频率过高

项目中上线监测捕捉闪退异常信息,好一部分是框架引起的,希望改进,同时祝框架越来越好
01ffbfc3359c97966833cf03fc36a51c
复现跟踪,打印po _waitDataTimer 输出为nil
框架使用的是最新的

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.