Commit 0aa9b68002eeca5ea82c7bf048cd00c6f4201bc6
1 parent
3b200504
错误提示
Showing
1 changed file
with
18 additions
and
1 deletions
VLionADSDKDemo/VLionADSDKDemo/AppDelegate.m
| ... | ... | @@ -31,7 +31,8 @@ |
| 31 | 31 | //开屏广告占位图建议与启动页LaunchImage相同 |
| 32 | 32 | UIImage *image = [UIImage imageNamed:@"placeholderImage"]; |
| 33 | 33 | |
| 34 | - [[VLionManager manager] vl_setupLaunchAdWithTagId:@"332" configuration:configuration keyWindow:[[UIApplication sharedApplication].delegate window] placeholderImage:image completeBlock:^(CGFloat w, CGFloat h, UIWindow * _Nonnull window) { | |
| 34 | + NSString *tagId = @"332"; // 广告位Id | |
| 35 | + [[VLionManager manager] vl_setupLaunchAdWithTagId:tagId configuration:configuration keyWindow:[[UIApplication sharedApplication].delegate window] placeholderImage:image completeBlock:^(CGFloat w, CGFloat h, UIWindow * _Nonnull window) { | |
| 35 | 36 | |
| 36 | 37 | NSLog(@"%f>>>>>%f>>>>>%@",w,h,window); |
| 37 | 38 | |
| ... | ... | @@ -45,6 +46,7 @@ |
| 45 | 46 | } failedBlock:^(NSDictionary * _Nullable errorDic) { |
| 46 | 47 | |
| 47 | 48 | NSLog(@"failed:%@",errorDic); |
| 49 | + [self toast:[NSString stringWithFormat:@"错误码:%@,%@\n请求广告位id:%@",errorDic[@"errorCode"],errorDic[@"errorMessage"],tagId]]; | |
| 48 | 50 | |
| 49 | 51 | } finishBlock:^{ |
| 50 | 52 | |
| ... | ... | @@ -53,6 +55,21 @@ |
| 53 | 55 | return YES; |
| 54 | 56 | } |
| 55 | 57 | |
| 58 | +#pragma mark - alertView | |
| 59 | +- (void)toast:(NSString *)message | |
| 60 | +{ | |
| 61 | + | |
| 62 | + UIAlertView *toast = [[UIAlertView alloc] initWithTitle:nil | |
| 63 | + message:message | |
| 64 | + delegate:nil | |
| 65 | + cancelButtonTitle:nil | |
| 66 | + otherButtonTitles:nil, nil]; | |
| 67 | + [toast show]; | |
| 68 | + double duration = 2.5; | |
| 69 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |
| 70 | + [toast dismissWithClickedButtonIndex:0 animated:NO]; | |
| 71 | + }); | |
| 72 | +} | |
| 56 | 73 | |
| 57 | 74 | - (void)applicationWillResignActive:(UIApplication *)application { |
| 58 | 75 | // 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. | ... | ... |