Commit d25d9e012ed08b0902f48211ded0a634b3f8ce98
1 parent
0aa9b680
toast
Showing
2 changed files
with
46 additions
and
1 deletions
VLionADSDKDemo/VLionADSDKDemo/BannerADController.m
| @@ -54,6 +54,10 @@ | @@ -54,6 +54,10 @@ | ||
| 54 | 54 | ||
| 55 | } failedBlock:^(NSDictionary * _Nonnull errorDic) { | 55 | } failedBlock:^(NSDictionary * _Nonnull errorDic) { |
| 56 | 56 | ||
| 57 | + NSString *errorStr = @""; | ||
| 58 | + errorStr = [errorStr stringByAppendingString:[NSString stringWithFormat:@"errorCode:%@\n", errorDic[@"errorCode"]]]; | ||
| 59 | + errorStr = [errorStr stringByAppendingString:[NSString stringWithFormat:@"errorMsg:%@\n", errorDic[@"errorMessage"]]]; | ||
| 60 | + [self toast:errorStr]; | ||
| 57 | NSLog(@"banner errorDic --------- (%@)", errorDic); | 61 | NSLog(@"banner errorDic --------- (%@)", errorDic); |
| 58 | 62 | ||
| 59 | }]; | 63 | }]; |
| @@ -65,6 +69,23 @@ | @@ -65,6 +69,23 @@ | ||
| 65 | [self dismissViewControllerAnimated:YES completion:NULL]; | 69 | [self dismissViewControllerAnimated:YES completion:NULL]; |
| 66 | } | 70 | } |
| 67 | 71 | ||
| 72 | +#pragma mark - | ||
| 73 | +#pragma mark - toast | ||
| 74 | +- (void)toast:(NSString *)message | ||
| 75 | +{ | ||
| 76 | + | ||
| 77 | + UIAlertView *toast = [[UIAlertView alloc] initWithTitle:nil | ||
| 78 | + message:message | ||
| 79 | + delegate:nil | ||
| 80 | + cancelButtonTitle:nil | ||
| 81 | + otherButtonTitles:nil, nil]; | ||
| 82 | + [toast show]; | ||
| 83 | + double duration = 2.5; | ||
| 84 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
| 85 | + [toast dismissWithClickedButtonIndex:0 animated:NO]; | ||
| 86 | + }); | ||
| 87 | +} | ||
| 88 | + | ||
| 68 | -(void)dealloc { | 89 | -(void)dealloc { |
| 69 | NSLog(@"BannerADController dealloc"); | 90 | NSLog(@"BannerADController dealloc"); |
| 70 | } | 91 | } |
VLionADSDKDemo/VLionADSDKDemo/ViewController.m
| @@ -100,6 +100,11 @@ | @@ -100,6 +100,11 @@ | ||
| 100 | 100 | ||
| 101 | } failedBlock:^(NSDictionary * _Nonnull errorDic) { | 101 | } failedBlock:^(NSDictionary * _Nonnull errorDic) { |
| 102 | 102 | ||
| 103 | + NSString *errorStr = @""; | ||
| 104 | + errorStr = [errorStr stringByAppendingString:[NSString stringWithFormat:@"errorCode:%@\n", errorDic[@"errorCode"]]]; | ||
| 105 | + errorStr = [errorStr stringByAppendingString:[NSString stringWithFormat:@"errorMsg:%@\n", errorDic[@"errorMessage"]]]; | ||
| 106 | + [self toast:errorStr]; | ||
| 107 | + | ||
| 103 | NSLog(@"interstitialView -------- (%@)",errorDic); | 108 | NSLog(@"interstitialView -------- (%@)",errorDic); |
| 104 | 109 | ||
| 105 | } closeBlock:^{ | 110 | } closeBlock:^{ |
| @@ -141,6 +146,10 @@ | @@ -141,6 +146,10 @@ | ||
| 141 | 146 | ||
| 142 | } failedBlock:^(NSDictionary * _Nonnull errorDic) { | 147 | } failedBlock:^(NSDictionary * _Nonnull errorDic) { |
| 143 | 148 | ||
| 149 | + NSString *errorStr = @""; | ||
| 150 | + errorStr = [errorStr stringByAppendingString:[NSString stringWithFormat:@"errorCode:%@\n", errorDic[@"errorCode"]]]; | ||
| 151 | + errorStr = [errorStr stringByAppendingString:[NSString stringWithFormat:@"errorMsg:%@\n", errorDic[@"errorMessage"]]]; | ||
| 152 | + [self toast:errorStr]; | ||
| 144 | NSLog(@"interstitialView -------- (%@)",errorDic); | 153 | NSLog(@"interstitialView -------- (%@)",errorDic); |
| 145 | 154 | ||
| 146 | } closeBlock:^{ | 155 | } closeBlock:^{ |
| @@ -163,7 +172,22 @@ | @@ -163,7 +172,22 @@ | ||
| 163 | } | 172 | } |
| 164 | } | 173 | } |
| 165 | 174 | ||
| 166 | - | 175 | +#pragma mark - |
| 176 | +#pragma mark - toast | ||
| 177 | +- (void)toast:(NSString *)message | ||
| 178 | +{ | ||
| 179 | + | ||
| 180 | + UIAlertView *toast = [[UIAlertView alloc] initWithTitle:nil | ||
| 181 | + message:message | ||
| 182 | + delegate:nil | ||
| 183 | + cancelButtonTitle:nil | ||
| 184 | + otherButtonTitles:nil, nil]; | ||
| 185 | + [toast show]; | ||
| 186 | + double duration = 2.5; | ||
| 187 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | ||
| 188 | + [toast dismissWithClickedButtonIndex:0 animated:NO]; | ||
| 189 | + }); | ||
| 190 | +} | ||
| 167 | - (void)didReceiveMemoryWarning { | 191 | - (void)didReceiveMemoryWarning { |
| 168 | [super didReceiveMemoryWarning]; | 192 | [super didReceiveMemoryWarning]; |
| 169 | // Dispose of any resources that can be recreated. | 193 | // Dispose of any resources that can be recreated. |