├── LaunchAD ├── 效果图.gif ├── ViewController.h ├── ADViewController.h ├── AppDelegate.h ├── main.m ├── ADViewController.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── ADView.h ├── ViewController.m ├── Info.plist ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── AppDelegate.m └── ADView.m ├── LaunchAD.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── xiongchao.xcuserdatad │ │ └── UserInterfaceState.xcuserstate ├── xcuserdata │ └── xiongchao.xcuserdatad │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── LaunchAD.xcscheme └── project.pbxproj ├── LaunchADTests ├── Info.plist └── LaunchADTests.m ├── LaunchADUITests ├── Info.plist └── LaunchADUITests.m └── README.md /LaunchAD/效果图.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongoahc/LaunchAD/HEAD/LaunchAD/效果图.gif -------------------------------------------------------------------------------- /LaunchAD.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /LaunchAD.xcodeproj/project.xcworkspace/xcuserdata/xiongchao.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xiongoahc/LaunchAD/HEAD/LaunchAD.xcodeproj/project.xcworkspace/xcuserdata/xiongchao.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /LaunchAD/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // LaunchAD 4 | // 5 | // Created by xiongoahc on 16/9/12. 6 | // Copyright © 2016年 xiongoahc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /LaunchAD/ADViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ADViewController.h 3 | // LaunchAD 4 | // 5 | // Created by xiongoahc on 16/9/12. 6 | // Copyright © 2016年 xiongoahc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ADViewController : UIViewController 12 | 13 | @property (nonatomic, copy) NSString *adUrl; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /LaunchAD/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // LaunchAD 4 | // 5 | // Created by xiongoahc on 16/9/12. 6 | // Copyright © 2016年 xiongoahc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /LaunchAD/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // LaunchAD 4 | // 5 | // Created by xiongoahc on 16/9/12. 6 | // Copyright © 2016年 xiongoahc. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /LaunchAD/ADViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ADViewController.m 3 | // LaunchAD 4 | // 5 | // Created by xiongoahc on 16/9/12. 6 | // Copyright © 2016年 xiongoahc. All rights reserved. 7 | // 8 | 9 | #import "ADViewController.h" 10 | 11 | @interface ADViewController () 12 | 13 | @end 14 | 15 | @implementation ADViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | 20 | self.title = @"广告页面"; 21 | UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.bounds]; 22 | webView.backgroundColor = [UIColor whiteColor]; 23 | NSURLRequest* request = [NSURLRequest requestWithURL:[NSURL URLWithString:self.adUrl]]; 24 | [webView loadRequest:request]; 25 | [self.view addSubview:webView]; 26 | } 27 | 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /LaunchAD/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /LaunchAD/ADView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ADView.h 3 | // LaunchAD 4 | // 5 | // Created by xiongoahc on 16/9/12. 6 | // Copyright © 2016年 xiongoahc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width 12 | #define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height 13 | #define UserDefaults [NSUserDefaults standardUserDefaults] 14 | static NSString *const adImageName = @"adImageName"; 15 | static NSString *const adUrl = @"adUrl"; 16 | 17 | @interface ADView : UIView 18 | 19 | /** 倒计时(默认3秒) */ 20 | @property (nonatomic,assign) NSUInteger showTime; 21 | 22 | /** 初始化方法*/ 23 | - (instancetype)initWithFrame:(CGRect)frame imgUrl:(NSString *)img adUrl:(NSString *)ad clickImg:(void(^)(NSString *clikImgUrl))block; 24 | 25 | /** 显示广告页面方法*/ 26 | - (void)show; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /LaunchADTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LaunchADUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /LaunchAD.xcodeproj/xcuserdata/xiongchao.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | LaunchAD.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 030DDD211D86BD47008E58C6 16 | 17 | primary 18 | 19 | 20 | 030DDD3A1D86BD47008E58C6 21 | 22 | primary 23 | 24 | 25 | 030DDD451D86BD47008E58C6 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LaunchAD 2 | 两行代码添加iOS应用启动广告的功能,支持无网络显示,可点击进入广告页面。 3 | 4 | 广告思路:第一次进入app时没有广告(因为广告的加载最好是从本地缓存获取,如果每次都从网络获取有可能因网速原因加载失败)。第一次启动的同时,根据后台返回的数据加载广告(一般是图片地址和广告链接),然后保存在本地。第二次启动的时候本地存在了广告,这个时候就可以显示了。然后请求最新的广告数据,如果和旧广告一样则不做操作;如果有新广告,则删除本地的旧广告,保存新广告,下次启动再显示。 5 | 6 | ![image](https://github.com/xiongoahc/LaunchAD/blob/master/LaunchAD/%E6%95%88%E6%9E%9C%E5%9B%BE.gif) 7 | 使用方法: 8 | 在使用的地方导入头文件ADView.h之后,添加如下代码 9 | 10 | NSString *imageUrl = @"http://img5q.duitang.com/uploads/item/201505/25/20150525223238_NdQrh.thumb.700_0.png"; 11 | NSString *adURL = @"http://tieba.baidu.com/"; 12 | 13 | //1、创建广告 14 | ADView *adView = [[ADView alloc] initWithFrame:[UIApplication sharedApplication].keyWindow.bounds andImgUrl:imageUrl andADUrl:adURL andClickBlock:^(NSString *clikImgUrl) { 15 | 16 | NSLog(@"进入广告:%@",clikImgUrl); 17 | }]; 18 | 19 | //2、显示广告 20 | [adView show]; 21 | -------------------------------------------------------------------------------- /LaunchADTests/LaunchADTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LaunchADTests.m 3 | // LaunchADTests 4 | // 5 | // Created by xiongoahc on 16/9/12. 6 | // Copyright © 2016年 xiongoahc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LaunchADTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LaunchADTests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | // Put setup code here. This method is called before the invocation of each test method in the class. 20 | } 21 | 22 | - (void)tearDown { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | [super tearDown]; 25 | } 26 | 27 | - (void)testExample { 28 | // This is an example of a functional test case. 29 | // Use XCTAssert and related functions to verify your tests produce the correct results. 30 | } 31 | 32 | - (void)testPerformanceExample { 33 | // This is an example of a performance test case. 34 | [self measureBlock:^{ 35 | // Put the code you want to measure the time of here. 36 | }]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /LaunchAD/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // LaunchAD 4 | // 5 | // Created by xiongoahc on 16/9/12. 6 | // Copyright © 2016年 xiongoahc. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "ADView.h" 11 | #import "ADViewController.h" 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | 21 | self.title = @"首页"; 22 | 23 | // NSString *image = @"http://img5.duitang.com/uploads/item/201501/05/20150105184318_w8HPK.jpeg"; 24 | // NSString *ad = @"http://www.jianshu.com"; 25 | 26 | NSString *image = @"http://img5q.duitang.com/uploads/item/201505/25/20150525223238_NdQrh.thumb.700_0.png"; 27 | NSString *ad = @"http://tieba.baidu.com/"; 28 | 29 | //1、创建广告 30 | ADView *adView = [[ADView alloc] initWithFrame:[UIApplication sharedApplication].keyWindow.bounds imgUrl:image adUrl:ad clickImg:^(NSString *clikImgUrl) { 31 | NSLog(@"进入广告:%@",clikImgUrl); 32 | ADViewController *adVc = [[ADViewController alloc] init]; 33 | adVc.adUrl = clikImgUrl; 34 | [self.navigationController pushViewController:adVc animated:YES]; 35 | 36 | }]; 37 | //设置倒计时(默认3秒) 38 | adView.showTime = 5; 39 | 40 | //2、显示广告 41 | [adView show]; 42 | 43 | } 44 | 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /LaunchADUITests/LaunchADUITests.m: -------------------------------------------------------------------------------- 1 | // 2 | // LaunchADUITests.m 3 | // LaunchADUITests 4 | // 5 | // Created by xiongoahc on 16/9/12. 6 | // Copyright © 2016年 xiongoahc. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface LaunchADUITests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation LaunchADUITests 16 | 17 | - (void)setUp { 18 | [super setUp]; 19 | 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | 22 | // In UI tests it is usually best to stop immediately when a failure occurs. 23 | self.continueAfterFailure = NO; 24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 25 | [[[XCUIApplication alloc] init] launch]; 26 | 27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 28 | } 29 | 30 | - (void)tearDown { 31 | // Put teardown code here. This method is called after the invocation of each test method in the class. 32 | [super tearDown]; 33 | } 34 | 35 | - (void)testExample { 36 | // Use recording to get started writing UI tests. 37 | // Use XCTAssert and related functions to verify your tests produce the correct results. 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /LaunchAD/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSAppTransportSecurity 6 | 7 | NSAllowsArbitraryLoads 8 | 9 | 10 | CFBundleDevelopmentRegion 11 | en 12 | CFBundleExecutable 13 | $(EXECUTABLE_NAME) 14 | CFBundleIdentifier 15 | $(PRODUCT_BUNDLE_IDENTIFIER) 16 | CFBundleInfoDictionaryVersion 17 | 6.0 18 | CFBundleName 19 | $(PRODUCT_NAME) 20 | CFBundlePackageType 21 | APPL 22 | CFBundleShortVersionString 23 | 1.0 24 | CFBundleSignature 25 | ???? 26 | CFBundleVersion 27 | 1 28 | LSRequiresIPhoneOS 29 | 30 | UILaunchStoryboardName 31 | LaunchScreen 32 | UIMainStoryboardFile 33 | Main 34 | UIRequiredDeviceCapabilities 35 | 36 | armv7 37 | 38 | UISupportedInterfaceOrientations 39 | 40 | UIInterfaceOrientationPortrait 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /LaunchAD/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /LaunchAD/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // LaunchAD 4 | // 5 | // Created by xiongoahc on 16/9/12. 6 | // Copyright © 2016年 xiongoahc. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /LaunchAD/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /LaunchAD.xcodeproj/xcuserdata/xiongchao.xcuserdatad/xcschemes/LaunchAD.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /LaunchAD/ADView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ADView.m 3 | // LaunchAD 4 | // 5 | // Created by xiongoahc on 16/9/12. 6 | // Copyright © 2016年 xiongoahc. All rights reserved. 7 | // 8 | 9 | #import "ADView.h" 10 | 11 | @interface ADView() 12 | 13 | @property (nonatomic, strong) UIImageView *adView; 14 | 15 | @property (nonatomic, strong) UIButton *countBtn; 16 | 17 | @property (nonatomic, strong) NSTimer *countTimer; 18 | 19 | 20 | @property (nonatomic, assign) NSUInteger count; 21 | 22 | /** 广告图片本地路径 */ 23 | @property (nonatomic,copy) NSString *imgPath; 24 | 25 | /** 新广告图片地址 */ 26 | @property (nonatomic,copy) NSString *imgUrl; 27 | 28 | /** 新广告的链接 */ 29 | @property (nonatomic,copy) NSString *adUrl; 30 | 31 | /** 所点击的广告链接 */ 32 | @property (nonatomic,copy) NSString *clickAdUrl; 33 | 34 | /** 点击图片回调block */ 35 | @property (nonatomic,copy) void (^clickImg)(NSString *url); 36 | 37 | @end 38 | 39 | @implementation ADView 40 | 41 | -(NSUInteger)showTime 42 | { 43 | if (_showTime == 0) 44 | { 45 | _showTime = 3; 46 | } 47 | return _showTime; 48 | } 49 | 50 | - (NSTimer *)countTimer 51 | { 52 | if (!_countTimer) { 53 | _countTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(countDown) userInfo:nil repeats:YES]; 54 | } 55 | return _countTimer; 56 | } 57 | 58 | /** 59 | * 初始化 60 | * 61 | * @param frame 坐标 62 | * @param imageUrl 图片地址 63 | * @param adUrl 广告链接 64 | * @param block 点击广告回调 65 | * 66 | * @return self 67 | */ 68 | - (instancetype)initWithFrame:(CGRect)frame imgUrl:(NSString *)img adUrl:(NSString *)ad clickImg:(void(^)(NSString *clikImgUrl))block 69 | { 70 | self = [super initWithFrame:frame]; 71 | if (self) { 72 | 73 | //给属性赋值 74 | _clickImg = block; 75 | _imgUrl = img; 76 | _adUrl = ad; 77 | 78 | //广告图片 79 | _adView = [[UIImageView alloc] initWithFrame:frame]; 80 | _adView.userInteractionEnabled = YES; 81 | _adView.contentMode = UIViewContentModeScaleAspectFill; 82 | _adView.clipsToBounds = YES; 83 | UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pushToAd)]; 84 | [_adView addGestureRecognizer:tap]; 85 | 86 | //跳过按钮 87 | CGFloat btnW = 60; 88 | CGFloat btnH = 30; 89 | _countBtn = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - btnW - 24, btnH, btnW, btnH)]; 90 | [_countBtn addTarget:self action:@selector(dismiss) forControlEvents:UIControlEventTouchUpInside]; 91 | _countBtn.titleLabel.font = [UIFont systemFontOfSize:15]; 92 | [_countBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 93 | _countBtn.backgroundColor = [UIColor colorWithRed:38 /255.0 green:38 /255.0 blue:38 /255.0 alpha:0.6]; 94 | _countBtn.layer.cornerRadius = 4; 95 | 96 | [self addSubview:_adView]; 97 | [self addSubview:_countBtn]; 98 | 99 | } 100 | return self; 101 | } 102 | 103 | 104 | - (void)show 105 | { 106 | //判断本地缓存广告是否存在,存在即显示 107 | if ([self imageExist]) { 108 | //设置按钮倒计时 109 | [_countBtn setTitle:[NSString stringWithFormat:@"跳过%zd", self.showTime] forState:UIControlStateNormal]; 110 | //当前显示的广告图片 111 | _adView.image = [UIImage imageWithContentsOfFile:_imgPath]; 112 | //当前显示的广告链接 113 | _clickAdUrl = [UserDefaults valueForKey:adUrl]; 114 | //开启倒计时 115 | [self startTimer]; 116 | UIWindow *window = [UIApplication sharedApplication].keyWindow; 117 | [window addSubview:self]; 118 | } 119 | else 120 | { 121 | //获取最新图片 122 | [self setNewADImgUrl:_imgUrl]; 123 | } 124 | 125 | } 126 | 127 | 128 | //判断沙盒中是否存在广告图片,如果存在,直接显示 129 | - (BOOL)imageExist 130 | { 131 | _imgPath = [self getFilePathWithImageName:[UserDefaults valueForKey:adImageName]]; 132 | NSFileManager *fileManager = [NSFileManager defaultManager]; 133 | BOOL isExist = [fileManager fileExistsAtPath:_imgPath]; 134 | return isExist; 135 | } 136 | 137 | 138 | //跳转到广告页面 139 | - (void)pushToAd{ 140 | if (_clickAdUrl) 141 | { 142 | //把所点击的广告链接回调出去 143 | _clickImg(_clickAdUrl); 144 | [self dismiss]; 145 | } 146 | 147 | } 148 | 149 | //跳过 150 | - (void)countDown 151 | { 152 | _count --; 153 | [_countBtn setTitle:[NSString stringWithFormat:@"跳过%zd",_count] forState:UIControlStateNormal]; 154 | if (_count == 0) { 155 | 156 | [self dismiss]; 157 | } 158 | } 159 | 160 | 161 | // 定时器倒计时 162 | - (void)startTimer 163 | { 164 | _count = self.showTime; 165 | [[NSRunLoop mainRunLoop] addTimer:self.countTimer forMode:NSRunLoopCommonModes]; 166 | } 167 | 168 | 169 | // 移除广告页面 170 | - (void)dismiss 171 | { 172 | [self.countTimer invalidate]; 173 | self.countTimer = nil; 174 | 175 | [UIView animateWithDuration:0.3f animations:^{ 176 | 177 | self.alpha = 0.f; 178 | 179 | } completion:^(BOOL finished) { 180 | 181 | [self removeFromSuperview]; 182 | //获取最新图片,为下一次启动做准备 183 | [self setNewADImgUrl:_imgUrl]; 184 | }]; 185 | } 186 | 187 | //获取最新广告 188 | - (void)setNewADImgUrl:(NSString *)imgUrl 189 | { 190 | //获取图片名字(***.png) 191 | NSString *imgName = [imgUrl lastPathComponent]; 192 | //拼接沙盒路径 193 | NSString *filePath = [self getFilePathWithImageName:imgName]; 194 | //判断路径是否存在 195 | NSFileManager *fileManager = [NSFileManager defaultManager]; 196 | BOOL isExist = [fileManager fileExistsAtPath:filePath]; 197 | if (!isExist){// 如果本地没有该图片,下载新图片保存,并且删除旧图片 198 | [self downloadAdImageWithUrl:imgUrl imageName:imgName]; 199 | } 200 | } 201 | 202 | /** 203 | * 下载新图片(这里也可以自己使用SDWebImage来下载图片) 204 | */ 205 | - (void)downloadAdImageWithUrl:(NSString *)imageUrl imageName:(NSString *)imageName 206 | { 207 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 208 | 209 | NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:imageUrl]]; 210 | UIImage *image = [UIImage imageWithData:data]; 211 | 212 | NSString *filePath = [self getFilePathWithImageName:imageName]; 213 | if ([UIImagePNGRepresentation(image) writeToFile:filePath atomically:YES]) {// 保存成功 214 | NSLog(@"保存成功"); 215 | //删除旧广告图片 216 | [self deleteOldImage]; 217 | //设置新图片 218 | [UserDefaults setValue:imageName forKey:adImageName]; 219 | //设置广告链接 220 | [UserDefaults setValue:_adUrl forKey:adUrl]; 221 | [UserDefaults synchronize]; 222 | }else{ 223 | NSLog(@"保存失败"); 224 | } 225 | 226 | }); 227 | } 228 | 229 | 230 | /** 231 | * 根据图片名拼接文件路径 232 | */ 233 | - (NSString *)getFilePathWithImageName:(NSString *)imageName 234 | { 235 | 236 | if (imageName) { 237 | NSString *cachesPath = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory,NSUserDomainMask, YES) firstObject]; 238 | NSString *imgPath =[cachesPath stringByAppendingPathComponent:imageName]; 239 | return imgPath; 240 | } 241 | return nil; 242 | } 243 | 244 | 245 | /** 246 | * 删除旧图片 247 | */ 248 | - (void)deleteOldImage 249 | { 250 | NSString *imageName = [UserDefaults valueForKey:adImageName]; 251 | if (imageName) { 252 | NSString *imgPath = [self getFilePathWithImageName:imageName]; 253 | NSFileManager *fileManager = [NSFileManager defaultManager]; 254 | [fileManager removeItemAtPath:imgPath error:nil]; 255 | } 256 | } 257 | 258 | @end 259 | -------------------------------------------------------------------------------- /LaunchAD.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 030DDD271D86BD47008E58C6 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 030DDD261D86BD47008E58C6 /* main.m */; }; 11 | 030DDD2A1D86BD47008E58C6 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 030DDD291D86BD47008E58C6 /* AppDelegate.m */; }; 12 | 030DDD2D1D86BD47008E58C6 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 030DDD2C1D86BD47008E58C6 /* ViewController.m */; }; 13 | 030DDD301D86BD47008E58C6 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 030DDD2E1D86BD47008E58C6 /* Main.storyboard */; }; 14 | 030DDD321D86BD47008E58C6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 030DDD311D86BD47008E58C6 /* Assets.xcassets */; }; 15 | 030DDD351D86BD47008E58C6 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 030DDD331D86BD47008E58C6 /* LaunchScreen.storyboard */; }; 16 | 030DDD401D86BD47008E58C6 /* LaunchADTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 030DDD3F1D86BD47008E58C6 /* LaunchADTests.m */; }; 17 | 030DDD4B1D86BD47008E58C6 /* LaunchADUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 030DDD4A1D86BD47008E58C6 /* LaunchADUITests.m */; }; 18 | 030DDD5A1D86BD84008E58C6 /* ADViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 030DDD591D86BD84008E58C6 /* ADViewController.m */; }; 19 | 030DDD5D1D86BF4F008E58C6 /* ADView.m in Sources */ = {isa = PBXBuildFile; fileRef = 030DDD5C1D86BF4F008E58C6 /* ADView.m */; }; 20 | 030DDD5F1D86DB2A008E58C6 /* 效果图.gif in Resources */ = {isa = PBXBuildFile; fileRef = 030DDD5E1D86DB2A008E58C6 /* 效果图.gif */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXContainerItemProxy section */ 24 | 030DDD3C1D86BD47008E58C6 /* PBXContainerItemProxy */ = { 25 | isa = PBXContainerItemProxy; 26 | containerPortal = 030DDD1A1D86BD47008E58C6 /* Project object */; 27 | proxyType = 1; 28 | remoteGlobalIDString = 030DDD211D86BD47008E58C6; 29 | remoteInfo = LaunchAD; 30 | }; 31 | 030DDD471D86BD47008E58C6 /* PBXContainerItemProxy */ = { 32 | isa = PBXContainerItemProxy; 33 | containerPortal = 030DDD1A1D86BD47008E58C6 /* Project object */; 34 | proxyType = 1; 35 | remoteGlobalIDString = 030DDD211D86BD47008E58C6; 36 | remoteInfo = LaunchAD; 37 | }; 38 | /* End PBXContainerItemProxy section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | 030DDD221D86BD47008E58C6 /* LaunchAD.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LaunchAD.app; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 030DDD261D86BD47008E58C6 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 43 | 030DDD281D86BD47008E58C6 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 44 | 030DDD291D86BD47008E58C6 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 45 | 030DDD2B1D86BD47008E58C6 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 46 | 030DDD2C1D86BD47008E58C6 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 47 | 030DDD2F1D86BD47008E58C6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 48 | 030DDD311D86BD47008E58C6 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 49 | 030DDD341D86BD47008E58C6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 50 | 030DDD361D86BD47008E58C6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | 030DDD3B1D86BD47008E58C6 /* LaunchADTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LaunchADTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 030DDD3F1D86BD47008E58C6 /* LaunchADTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LaunchADTests.m; sourceTree = ""; }; 53 | 030DDD411D86BD47008E58C6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | 030DDD461D86BD47008E58C6 /* LaunchADUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LaunchADUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | 030DDD4A1D86BD47008E58C6 /* LaunchADUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LaunchADUITests.m; sourceTree = ""; }; 56 | 030DDD4C1D86BD47008E58C6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 57 | 030DDD581D86BD84008E58C6 /* ADViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADViewController.h; sourceTree = ""; }; 58 | 030DDD591D86BD84008E58C6 /* ADViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADViewController.m; sourceTree = ""; }; 59 | 030DDD5B1D86BF4F008E58C6 /* ADView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ADView.h; sourceTree = ""; }; 60 | 030DDD5C1D86BF4F008E58C6 /* ADView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ADView.m; sourceTree = ""; }; 61 | 030DDD5E1D86DB2A008E58C6 /* 效果图.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = "效果图.gif"; sourceTree = ""; }; 62 | /* End PBXFileReference section */ 63 | 64 | /* Begin PBXFrameworksBuildPhase section */ 65 | 030DDD1F1D86BD47008E58C6 /* Frameworks */ = { 66 | isa = PBXFrameworksBuildPhase; 67 | buildActionMask = 2147483647; 68 | files = ( 69 | ); 70 | runOnlyForDeploymentPostprocessing = 0; 71 | }; 72 | 030DDD381D86BD47008E58C6 /* Frameworks */ = { 73 | isa = PBXFrameworksBuildPhase; 74 | buildActionMask = 2147483647; 75 | files = ( 76 | ); 77 | runOnlyForDeploymentPostprocessing = 0; 78 | }; 79 | 030DDD431D86BD47008E58C6 /* Frameworks */ = { 80 | isa = PBXFrameworksBuildPhase; 81 | buildActionMask = 2147483647; 82 | files = ( 83 | ); 84 | runOnlyForDeploymentPostprocessing = 0; 85 | }; 86 | /* End PBXFrameworksBuildPhase section */ 87 | 88 | /* Begin PBXGroup section */ 89 | 030DDD191D86BD47008E58C6 = { 90 | isa = PBXGroup; 91 | children = ( 92 | 030DDD241D86BD47008E58C6 /* LaunchAD */, 93 | 030DDD3E1D86BD47008E58C6 /* LaunchADTests */, 94 | 030DDD491D86BD47008E58C6 /* LaunchADUITests */, 95 | 030DDD231D86BD47008E58C6 /* Products */, 96 | ); 97 | sourceTree = ""; 98 | }; 99 | 030DDD231D86BD47008E58C6 /* Products */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 030DDD221D86BD47008E58C6 /* LaunchAD.app */, 103 | 030DDD3B1D86BD47008E58C6 /* LaunchADTests.xctest */, 104 | 030DDD461D86BD47008E58C6 /* LaunchADUITests.xctest */, 105 | ); 106 | name = Products; 107 | sourceTree = ""; 108 | }; 109 | 030DDD241D86BD47008E58C6 /* LaunchAD */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | 030DDD5E1D86DB2A008E58C6 /* 效果图.gif */, 113 | 030DDD281D86BD47008E58C6 /* AppDelegate.h */, 114 | 030DDD291D86BD47008E58C6 /* AppDelegate.m */, 115 | 030DDD2B1D86BD47008E58C6 /* ViewController.h */, 116 | 030DDD2C1D86BD47008E58C6 /* ViewController.m */, 117 | 030DDD5B1D86BF4F008E58C6 /* ADView.h */, 118 | 030DDD5C1D86BF4F008E58C6 /* ADView.m */, 119 | 030DDD581D86BD84008E58C6 /* ADViewController.h */, 120 | 030DDD591D86BD84008E58C6 /* ADViewController.m */, 121 | 030DDD2E1D86BD47008E58C6 /* Main.storyboard */, 122 | 030DDD311D86BD47008E58C6 /* Assets.xcassets */, 123 | 030DDD331D86BD47008E58C6 /* LaunchScreen.storyboard */, 124 | 030DDD361D86BD47008E58C6 /* Info.plist */, 125 | 030DDD251D86BD47008E58C6 /* Supporting Files */, 126 | ); 127 | path = LaunchAD; 128 | sourceTree = ""; 129 | }; 130 | 030DDD251D86BD47008E58C6 /* Supporting Files */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | 030DDD261D86BD47008E58C6 /* main.m */, 134 | ); 135 | name = "Supporting Files"; 136 | sourceTree = ""; 137 | }; 138 | 030DDD3E1D86BD47008E58C6 /* LaunchADTests */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | 030DDD3F1D86BD47008E58C6 /* LaunchADTests.m */, 142 | 030DDD411D86BD47008E58C6 /* Info.plist */, 143 | ); 144 | path = LaunchADTests; 145 | sourceTree = ""; 146 | }; 147 | 030DDD491D86BD47008E58C6 /* LaunchADUITests */ = { 148 | isa = PBXGroup; 149 | children = ( 150 | 030DDD4A1D86BD47008E58C6 /* LaunchADUITests.m */, 151 | 030DDD4C1D86BD47008E58C6 /* Info.plist */, 152 | ); 153 | path = LaunchADUITests; 154 | sourceTree = ""; 155 | }; 156 | /* End PBXGroup section */ 157 | 158 | /* Begin PBXNativeTarget section */ 159 | 030DDD211D86BD47008E58C6 /* LaunchAD */ = { 160 | isa = PBXNativeTarget; 161 | buildConfigurationList = 030DDD4F1D86BD48008E58C6 /* Build configuration list for PBXNativeTarget "LaunchAD" */; 162 | buildPhases = ( 163 | 030DDD1E1D86BD47008E58C6 /* Sources */, 164 | 030DDD1F1D86BD47008E58C6 /* Frameworks */, 165 | 030DDD201D86BD47008E58C6 /* Resources */, 166 | ); 167 | buildRules = ( 168 | ); 169 | dependencies = ( 170 | ); 171 | name = LaunchAD; 172 | productName = LaunchAD; 173 | productReference = 030DDD221D86BD47008E58C6 /* LaunchAD.app */; 174 | productType = "com.apple.product-type.application"; 175 | }; 176 | 030DDD3A1D86BD47008E58C6 /* LaunchADTests */ = { 177 | isa = PBXNativeTarget; 178 | buildConfigurationList = 030DDD521D86BD48008E58C6 /* Build configuration list for PBXNativeTarget "LaunchADTests" */; 179 | buildPhases = ( 180 | 030DDD371D86BD47008E58C6 /* Sources */, 181 | 030DDD381D86BD47008E58C6 /* Frameworks */, 182 | 030DDD391D86BD47008E58C6 /* Resources */, 183 | ); 184 | buildRules = ( 185 | ); 186 | dependencies = ( 187 | 030DDD3D1D86BD47008E58C6 /* PBXTargetDependency */, 188 | ); 189 | name = LaunchADTests; 190 | productName = LaunchADTests; 191 | productReference = 030DDD3B1D86BD47008E58C6 /* LaunchADTests.xctest */; 192 | productType = "com.apple.product-type.bundle.unit-test"; 193 | }; 194 | 030DDD451D86BD47008E58C6 /* LaunchADUITests */ = { 195 | isa = PBXNativeTarget; 196 | buildConfigurationList = 030DDD551D86BD48008E58C6 /* Build configuration list for PBXNativeTarget "LaunchADUITests" */; 197 | buildPhases = ( 198 | 030DDD421D86BD47008E58C6 /* Sources */, 199 | 030DDD431D86BD47008E58C6 /* Frameworks */, 200 | 030DDD441D86BD47008E58C6 /* Resources */, 201 | ); 202 | buildRules = ( 203 | ); 204 | dependencies = ( 205 | 030DDD481D86BD47008E58C6 /* PBXTargetDependency */, 206 | ); 207 | name = LaunchADUITests; 208 | productName = LaunchADUITests; 209 | productReference = 030DDD461D86BD47008E58C6 /* LaunchADUITests.xctest */; 210 | productType = "com.apple.product-type.bundle.ui-testing"; 211 | }; 212 | /* End PBXNativeTarget section */ 213 | 214 | /* Begin PBXProject section */ 215 | 030DDD1A1D86BD47008E58C6 /* Project object */ = { 216 | isa = PBXProject; 217 | attributes = { 218 | LastUpgradeCheck = 0730; 219 | ORGANIZATIONNAME = xiongchao; 220 | TargetAttributes = { 221 | 030DDD211D86BD47008E58C6 = { 222 | CreatedOnToolsVersion = 7.3.1; 223 | DevelopmentTeam = 9Z27TXA8KT; 224 | }; 225 | 030DDD3A1D86BD47008E58C6 = { 226 | CreatedOnToolsVersion = 7.3.1; 227 | DevelopmentTeam = 9Z27TXA8KT; 228 | TestTargetID = 030DDD211D86BD47008E58C6; 229 | }; 230 | 030DDD451D86BD47008E58C6 = { 231 | CreatedOnToolsVersion = 7.3.1; 232 | DevelopmentTeam = 9Z27TXA8KT; 233 | TestTargetID = 030DDD211D86BD47008E58C6; 234 | }; 235 | }; 236 | }; 237 | buildConfigurationList = 030DDD1D1D86BD47008E58C6 /* Build configuration list for PBXProject "LaunchAD" */; 238 | compatibilityVersion = "Xcode 3.2"; 239 | developmentRegion = English; 240 | hasScannedForEncodings = 0; 241 | knownRegions = ( 242 | en, 243 | Base, 244 | ); 245 | mainGroup = 030DDD191D86BD47008E58C6; 246 | productRefGroup = 030DDD231D86BD47008E58C6 /* Products */; 247 | projectDirPath = ""; 248 | projectRoot = ""; 249 | targets = ( 250 | 030DDD211D86BD47008E58C6 /* LaunchAD */, 251 | 030DDD3A1D86BD47008E58C6 /* LaunchADTests */, 252 | 030DDD451D86BD47008E58C6 /* LaunchADUITests */, 253 | ); 254 | }; 255 | /* End PBXProject section */ 256 | 257 | /* Begin PBXResourcesBuildPhase section */ 258 | 030DDD201D86BD47008E58C6 /* Resources */ = { 259 | isa = PBXResourcesBuildPhase; 260 | buildActionMask = 2147483647; 261 | files = ( 262 | 030DDD351D86BD47008E58C6 /* LaunchScreen.storyboard in Resources */, 263 | 030DDD5F1D86DB2A008E58C6 /* 效果图.gif in Resources */, 264 | 030DDD321D86BD47008E58C6 /* Assets.xcassets in Resources */, 265 | 030DDD301D86BD47008E58C6 /* Main.storyboard in Resources */, 266 | ); 267 | runOnlyForDeploymentPostprocessing = 0; 268 | }; 269 | 030DDD391D86BD47008E58C6 /* Resources */ = { 270 | isa = PBXResourcesBuildPhase; 271 | buildActionMask = 2147483647; 272 | files = ( 273 | ); 274 | runOnlyForDeploymentPostprocessing = 0; 275 | }; 276 | 030DDD441D86BD47008E58C6 /* Resources */ = { 277 | isa = PBXResourcesBuildPhase; 278 | buildActionMask = 2147483647; 279 | files = ( 280 | ); 281 | runOnlyForDeploymentPostprocessing = 0; 282 | }; 283 | /* End PBXResourcesBuildPhase section */ 284 | 285 | /* Begin PBXSourcesBuildPhase section */ 286 | 030DDD1E1D86BD47008E58C6 /* Sources */ = { 287 | isa = PBXSourcesBuildPhase; 288 | buildActionMask = 2147483647; 289 | files = ( 290 | 030DDD2D1D86BD47008E58C6 /* ViewController.m in Sources */, 291 | 030DDD5A1D86BD84008E58C6 /* ADViewController.m in Sources */, 292 | 030DDD2A1D86BD47008E58C6 /* AppDelegate.m in Sources */, 293 | 030DDD271D86BD47008E58C6 /* main.m in Sources */, 294 | 030DDD5D1D86BF4F008E58C6 /* ADView.m in Sources */, 295 | ); 296 | runOnlyForDeploymentPostprocessing = 0; 297 | }; 298 | 030DDD371D86BD47008E58C6 /* Sources */ = { 299 | isa = PBXSourcesBuildPhase; 300 | buildActionMask = 2147483647; 301 | files = ( 302 | 030DDD401D86BD47008E58C6 /* LaunchADTests.m in Sources */, 303 | ); 304 | runOnlyForDeploymentPostprocessing = 0; 305 | }; 306 | 030DDD421D86BD47008E58C6 /* Sources */ = { 307 | isa = PBXSourcesBuildPhase; 308 | buildActionMask = 2147483647; 309 | files = ( 310 | 030DDD4B1D86BD47008E58C6 /* LaunchADUITests.m in Sources */, 311 | ); 312 | runOnlyForDeploymentPostprocessing = 0; 313 | }; 314 | /* End PBXSourcesBuildPhase section */ 315 | 316 | /* Begin PBXTargetDependency section */ 317 | 030DDD3D1D86BD47008E58C6 /* PBXTargetDependency */ = { 318 | isa = PBXTargetDependency; 319 | target = 030DDD211D86BD47008E58C6 /* LaunchAD */; 320 | targetProxy = 030DDD3C1D86BD47008E58C6 /* PBXContainerItemProxy */; 321 | }; 322 | 030DDD481D86BD47008E58C6 /* PBXTargetDependency */ = { 323 | isa = PBXTargetDependency; 324 | target = 030DDD211D86BD47008E58C6 /* LaunchAD */; 325 | targetProxy = 030DDD471D86BD47008E58C6 /* PBXContainerItemProxy */; 326 | }; 327 | /* End PBXTargetDependency section */ 328 | 329 | /* Begin PBXVariantGroup section */ 330 | 030DDD2E1D86BD47008E58C6 /* Main.storyboard */ = { 331 | isa = PBXVariantGroup; 332 | children = ( 333 | 030DDD2F1D86BD47008E58C6 /* Base */, 334 | ); 335 | name = Main.storyboard; 336 | sourceTree = ""; 337 | }; 338 | 030DDD331D86BD47008E58C6 /* LaunchScreen.storyboard */ = { 339 | isa = PBXVariantGroup; 340 | children = ( 341 | 030DDD341D86BD47008E58C6 /* Base */, 342 | ); 343 | name = LaunchScreen.storyboard; 344 | sourceTree = ""; 345 | }; 346 | /* End PBXVariantGroup section */ 347 | 348 | /* Begin XCBuildConfiguration section */ 349 | 030DDD4D1D86BD48008E58C6 /* Debug */ = { 350 | isa = XCBuildConfiguration; 351 | buildSettings = { 352 | ALWAYS_SEARCH_USER_PATHS = NO; 353 | CLANG_ANALYZER_NONNULL = YES; 354 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 355 | CLANG_CXX_LIBRARY = "libc++"; 356 | CLANG_ENABLE_MODULES = YES; 357 | CLANG_ENABLE_OBJC_ARC = YES; 358 | CLANG_WARN_BOOL_CONVERSION = YES; 359 | CLANG_WARN_CONSTANT_CONVERSION = YES; 360 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 361 | CLANG_WARN_EMPTY_BODY = YES; 362 | CLANG_WARN_ENUM_CONVERSION = YES; 363 | CLANG_WARN_INT_CONVERSION = YES; 364 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 365 | CLANG_WARN_UNREACHABLE_CODE = YES; 366 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 367 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 368 | COPY_PHASE_STRIP = NO; 369 | DEBUG_INFORMATION_FORMAT = dwarf; 370 | ENABLE_STRICT_OBJC_MSGSEND = YES; 371 | ENABLE_TESTABILITY = YES; 372 | GCC_C_LANGUAGE_STANDARD = gnu99; 373 | GCC_DYNAMIC_NO_PIC = NO; 374 | GCC_NO_COMMON_BLOCKS = YES; 375 | GCC_OPTIMIZATION_LEVEL = 0; 376 | GCC_PREPROCESSOR_DEFINITIONS = ( 377 | "DEBUG=1", 378 | "$(inherited)", 379 | ); 380 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 381 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 382 | GCC_WARN_UNDECLARED_SELECTOR = YES; 383 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 384 | GCC_WARN_UNUSED_FUNCTION = YES; 385 | GCC_WARN_UNUSED_VARIABLE = YES; 386 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 387 | MTL_ENABLE_DEBUG_INFO = YES; 388 | ONLY_ACTIVE_ARCH = YES; 389 | SDKROOT = iphoneos; 390 | }; 391 | name = Debug; 392 | }; 393 | 030DDD4E1D86BD48008E58C6 /* Release */ = { 394 | isa = XCBuildConfiguration; 395 | buildSettings = { 396 | ALWAYS_SEARCH_USER_PATHS = NO; 397 | CLANG_ANALYZER_NONNULL = YES; 398 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 399 | CLANG_CXX_LIBRARY = "libc++"; 400 | CLANG_ENABLE_MODULES = YES; 401 | CLANG_ENABLE_OBJC_ARC = YES; 402 | CLANG_WARN_BOOL_CONVERSION = YES; 403 | CLANG_WARN_CONSTANT_CONVERSION = YES; 404 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 405 | CLANG_WARN_EMPTY_BODY = YES; 406 | CLANG_WARN_ENUM_CONVERSION = YES; 407 | CLANG_WARN_INT_CONVERSION = YES; 408 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 409 | CLANG_WARN_UNREACHABLE_CODE = YES; 410 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 411 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 412 | COPY_PHASE_STRIP = NO; 413 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 414 | ENABLE_NS_ASSERTIONS = NO; 415 | ENABLE_STRICT_OBJC_MSGSEND = YES; 416 | GCC_C_LANGUAGE_STANDARD = gnu99; 417 | GCC_NO_COMMON_BLOCKS = YES; 418 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 419 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 420 | GCC_WARN_UNDECLARED_SELECTOR = YES; 421 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 422 | GCC_WARN_UNUSED_FUNCTION = YES; 423 | GCC_WARN_UNUSED_VARIABLE = YES; 424 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 425 | MTL_ENABLE_DEBUG_INFO = NO; 426 | SDKROOT = iphoneos; 427 | VALIDATE_PRODUCT = YES; 428 | }; 429 | name = Release; 430 | }; 431 | 030DDD501D86BD48008E58C6 /* Debug */ = { 432 | isa = XCBuildConfiguration; 433 | buildSettings = { 434 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 435 | INFOPLIST_FILE = LaunchAD/Info.plist; 436 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 437 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 438 | PRODUCT_BUNDLE_IDENTIFIER = come.xiongchao.LaunchAD; 439 | PRODUCT_NAME = "$(TARGET_NAME)"; 440 | }; 441 | name = Debug; 442 | }; 443 | 030DDD511D86BD48008E58C6 /* Release */ = { 444 | isa = XCBuildConfiguration; 445 | buildSettings = { 446 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 447 | INFOPLIST_FILE = LaunchAD/Info.plist; 448 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 449 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 450 | PRODUCT_BUNDLE_IDENTIFIER = come.xiongchao.LaunchAD; 451 | PRODUCT_NAME = "$(TARGET_NAME)"; 452 | }; 453 | name = Release; 454 | }; 455 | 030DDD531D86BD48008E58C6 /* Debug */ = { 456 | isa = XCBuildConfiguration; 457 | buildSettings = { 458 | BUNDLE_LOADER = "$(TEST_HOST)"; 459 | INFOPLIST_FILE = LaunchADTests/Info.plist; 460 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 461 | PRODUCT_BUNDLE_IDENTIFIER = come.xiongchao.LaunchADTests; 462 | PRODUCT_NAME = "$(TARGET_NAME)"; 463 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LaunchAD.app/LaunchAD"; 464 | }; 465 | name = Debug; 466 | }; 467 | 030DDD541D86BD48008E58C6 /* Release */ = { 468 | isa = XCBuildConfiguration; 469 | buildSettings = { 470 | BUNDLE_LOADER = "$(TEST_HOST)"; 471 | INFOPLIST_FILE = LaunchADTests/Info.plist; 472 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 473 | PRODUCT_BUNDLE_IDENTIFIER = come.xiongchao.LaunchADTests; 474 | PRODUCT_NAME = "$(TARGET_NAME)"; 475 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/LaunchAD.app/LaunchAD"; 476 | }; 477 | name = Release; 478 | }; 479 | 030DDD561D86BD48008E58C6 /* Debug */ = { 480 | isa = XCBuildConfiguration; 481 | buildSettings = { 482 | INFOPLIST_FILE = LaunchADUITests/Info.plist; 483 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 484 | PRODUCT_BUNDLE_IDENTIFIER = come.xiongchao.LaunchADUITests; 485 | PRODUCT_NAME = "$(TARGET_NAME)"; 486 | TEST_TARGET_NAME = LaunchAD; 487 | }; 488 | name = Debug; 489 | }; 490 | 030DDD571D86BD48008E58C6 /* Release */ = { 491 | isa = XCBuildConfiguration; 492 | buildSettings = { 493 | INFOPLIST_FILE = LaunchADUITests/Info.plist; 494 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 495 | PRODUCT_BUNDLE_IDENTIFIER = come.xiongchao.LaunchADUITests; 496 | PRODUCT_NAME = "$(TARGET_NAME)"; 497 | TEST_TARGET_NAME = LaunchAD; 498 | }; 499 | name = Release; 500 | }; 501 | /* End XCBuildConfiguration section */ 502 | 503 | /* Begin XCConfigurationList section */ 504 | 030DDD1D1D86BD47008E58C6 /* Build configuration list for PBXProject "LaunchAD" */ = { 505 | isa = XCConfigurationList; 506 | buildConfigurations = ( 507 | 030DDD4D1D86BD48008E58C6 /* Debug */, 508 | 030DDD4E1D86BD48008E58C6 /* Release */, 509 | ); 510 | defaultConfigurationIsVisible = 0; 511 | defaultConfigurationName = Release; 512 | }; 513 | 030DDD4F1D86BD48008E58C6 /* Build configuration list for PBXNativeTarget "LaunchAD" */ = { 514 | isa = XCConfigurationList; 515 | buildConfigurations = ( 516 | 030DDD501D86BD48008E58C6 /* Debug */, 517 | 030DDD511D86BD48008E58C6 /* Release */, 518 | ); 519 | defaultConfigurationIsVisible = 0; 520 | defaultConfigurationName = Release; 521 | }; 522 | 030DDD521D86BD48008E58C6 /* Build configuration list for PBXNativeTarget "LaunchADTests" */ = { 523 | isa = XCConfigurationList; 524 | buildConfigurations = ( 525 | 030DDD531D86BD48008E58C6 /* Debug */, 526 | 030DDD541D86BD48008E58C6 /* Release */, 527 | ); 528 | defaultConfigurationIsVisible = 0; 529 | defaultConfigurationName = Release; 530 | }; 531 | 030DDD551D86BD48008E58C6 /* Build configuration list for PBXNativeTarget "LaunchADUITests" */ = { 532 | isa = XCConfigurationList; 533 | buildConfigurations = ( 534 | 030DDD561D86BD48008E58C6 /* Debug */, 535 | 030DDD571D86BD48008E58C6 /* Release */, 536 | ); 537 | defaultConfigurationIsVisible = 0; 538 | defaultConfigurationName = Release; 539 | }; 540 | /* End XCConfigurationList section */ 541 | }; 542 | rootObject = 030DDD1A1D86BD47008E58C6 /* Project object */; 543 | } 544 | --------------------------------------------------------------------------------