Network.m 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. //
  2. // Network.m
  3. // XHLaunchAdExample
  4. //
  5. // Created by zhuxiaohui on 2016/6/28.
  6. // Copyright © 2016年 it7090.com. All rights reserved.
  7. // 代码地址:https://github.com/CoderZhuXH/XHLaunchAd
  8. // 数据请求类
  9. #import "Network.h"
  10. @implementation Network
  11. /**
  12. * 此处模拟广告数据请求,实际项目中请做真实请求
  13. */
  14. +(void)getLaunchAdImageDataSuccess:(NetworkSucess)success failure:(NetworkFailure)failure;
  15. {
  16. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  17. NSData *JSONData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"LaunchImageAd" ofType:@"json"]];
  18. NSDictionary *json = [NSJSONSerialization JSONObjectWithData:JSONData options:NSJSONReadingAllowFragments error:nil];
  19. if(success) success(json);
  20. });
  21. }
  22. /**
  23. * 此处模拟广告数据请求,实际项目中请做真实请求
  24. */
  25. +(void)getLaunchAdVideoDataSuccess:(NetworkSucess)success failure:(NetworkFailure)failure;
  26. {
  27. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  28. NSData *JSONData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"LaunchVideoAd" ofType:@"json"]];
  29. NSDictionary *json = [NSJSONSerialization JSONObjectWithData:JSONData options:NSJSONReadingAllowFragments error:nil];
  30. if(success) success(json);
  31. });
  32. }
  33. @end