RQShareFunction.m 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. //
  2. // RQShareFunction.m
  3. // LN_School
  4. //
  5. // Created by 张嵘 on 2018/10/16.
  6. // Copyright © 2018 Danson. All rights reserved.
  7. //
  8. #import "RQShareFunction.h"
  9. #import "TZImagePickerController.h"//第三方相册
  10. #import <MOBFoundation/MobSDK+Privacy.h>
  11. static RQShareFunction *_instance = nil;
  12. static dispatch_once_t onceToken;
  13. @interface RQShareFunction ()
  14. @property (nonatomic, strong) NSArray *dataSource;
  15. @property (nonatomic, strong) UIPageControl *pageControl;
  16. @property (assign, readwrite, nonatomic) BOOL isCanSave;
  17. @end
  18. @implementation RQShareFunction
  19. + (instancetype)shareManager {
  20. return [[self alloc] init];
  21. }
  22. - (instancetype)init{
  23. dispatch_once(&onceToken, ^{
  24. _instance = [super init];
  25. });
  26. return _instance;
  27. }
  28. - (void)setShieldTopicIDArr:(NSArray *)shieldTopicIDArr {
  29. NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
  30. [userDefault setObject:shieldTopicIDArr forKey:@"shieldTopicIDArr"];
  31. [userDefault synchronize];
  32. }
  33. - (NSArray *)shieldTopicIDArr {
  34. NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
  35. NSArray *arr = (NSArray *)[userDefault objectForKey:@"shieldTopicIDArr"]? : [NSArray array];
  36. return arr;
  37. }
  38. - (void)setShieldPeopleIDArr:(NSArray *)shieldPeopleIDArr {
  39. NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
  40. [userDefault setObject:shieldPeopleIDArr forKey:@"shieldPeopleIDArr"];
  41. [userDefault synchronize];
  42. }
  43. - (NSArray *)shieldPeopleIDArr {
  44. NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
  45. NSArray *arr = (NSArray *)[userDefault objectForKey:@"shieldPeopleIDArr"]? : [NSArray array];
  46. return arr;
  47. }
  48. - (void)setAnnouncementIDArr:(NSArray *)announcementIDArr {
  49. NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
  50. [userDefault setObject:announcementIDArr forKey:@"announcementIDArr"];
  51. [userDefault synchronize];
  52. }
  53. - (NSArray *)announcementIDArr {
  54. NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
  55. NSArray *arr = (NSArray *)[userDefault objectForKey:@"announcementIDArr"]? : [NSArray array];
  56. return arr;
  57. }
  58. - (void)setCurrentUserInterfaceStyle:(UIUserInterfaceStyle)currentUserInterfaceStyle {
  59. NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
  60. [userDefault setInteger:currentUserInterfaceStyle forKey:@"currentUserInterfaceStyle"];
  61. [userDefault synchronize];
  62. }
  63. - (UIUserInterfaceStyle)currentUserInterfaceStyle{
  64. NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
  65. if (@available(iOS 12.0, *)) {
  66. UIUserInterfaceStyle style = (UIUserInterfaceStyle)[userDefault integerForKey:@"currentUserInterfaceStyle"]? : UIUserInterfaceStyleUnspecified;
  67. return style;
  68. } else {
  69. return 0;
  70. }
  71. }
  72. // 个人中心功能模块类型一(预约相关,模拟相关,资讯相关)(开启地市:福州-3501,厦门-3502,莆田-3503)
  73. - (NSArray *)personalTypeOneCityCodeArr {
  74. return @[@"3501", @"3502", @"3503"];
  75. }
  76. // 个人中心功能模块类型一(预约相关,资讯相关)(开启地市:温州-3303)
  77. - (NSArray *)personalTypeTwoCityCodeArr {
  78. return @[@"3303"];
  79. }
  80. // 学车计时功能模块类型一(理论计时,实操计时,模拟计时,我的学时)(开启地市:福州-3501,厦门-3502,温州-3303)
  81. - (NSArray *)timingTypeOneCityCodeArr {
  82. return @[@"3501", @"3502", @"3303"];
  83. }
  84. // 学车计时功能模块类型二(理论计时,我的学时)(开启地市:莆田-3503)
  85. - (NSArray *)timingTypeTwoCityCodeArr {
  86. return @[@"3503"];
  87. }
  88. // 理论计时类型一 (在科目二,科目三可以进行科目四的理论计时) (开启地市:福州-3501,莆田-3503)
  89. - (NSArray *)theoryOfTimingTypeOneCityCodeArr {
  90. return @[@"3501", @"3503"];
  91. }
  92. // 理论计时类型二地市编号:null (在科目二可以进行科目四的理论计时)(开启地市:)
  93. - (NSArray *)theoryOfTimingTypeTwoCityCodeArr {
  94. return @[];
  95. }
  96. // 理论计时类型三 (在科目三可以进行科目四的理论计时)(开启地市:厦门-3502)
  97. - (NSArray *)theoryOfTimingTypeThreeCityCodeArr {
  98. return @[@"3502"];
  99. }
  100. // 是否开启广告 默认0 不开通 1 开通
  101. - (BOOL)APP_AD {
  102. id object = [RQ_SHARE_FUNCTION getObjectWithKey:@"APP_AD"];
  103. BOOL appAd = [object boolValue];
  104. // return [RQ_SHARE_FUNCTION checkProxySetting]? NO : (object? appAd : YES);
  105. return object? appAd : YES;
  106. }
  107. //关闭广告概率 0-100% 关闭广告概率
  108. - (NSInteger)APP_CLOSE {
  109. id object = [RQ_SHARE_FUNCTION getObjectWithKey:@"APP_CLOSE"];
  110. NSInteger appClose = [object integerValue];
  111. return appClose;
  112. }
  113. - (NSInteger)APP_AD_CYCLE {
  114. id object = [RQ_SHARE_FUNCTION getObjectWithKey:@"APP_AD_CYCLE"];
  115. NSInteger appAdCycle = [object integerValue];
  116. return appAdCycle;
  117. }
  118. - (void)setAPP_AD:(BOOL)APP_AD {
  119. [RQ_SHARE_FUNCTION saveObjectWithObject:[NSNumber numberWithBool:APP_AD] ForKey:@"APP_AD"];
  120. }
  121. - (void)setAPP_CLOSE:(NSInteger)APP_CLOSE {
  122. [RQ_SHARE_FUNCTION saveObjectWithObject:[NSNumber numberWithInteger:APP_CLOSE] ForKey:@"APP_CLOSE"];
  123. }
  124. - (void)setAPP_AD_CYCLE:(NSInteger)APP_AD_CYCLE {
  125. [RQ_SHARE_FUNCTION saveObjectWithObject:[NSNumber numberWithInteger:APP_AD_CYCLE] ForKey:@"APP_AD_CYCLE"];
  126. }
  127. // 时间转换为时间戳,精确到微秒
  128. - (NSInteger)getTimeStampWithDate:(NSDate *)date {
  129. return [[NSNumber numberWithDouble:[date timeIntervalSince1970] * 1000 * 1000] integerValue];
  130. }
  131. // 时间戳转换为时间
  132. - (NSDate *)getDateWithTimeStamp:(NSInteger)timeStamp {
  133. return [NSDate dateWithTimeIntervalSince1970:timeStamp * 0.001 * 0.001];
  134. }
  135. // 一个时间戳与当前时间的间隔(s)
  136. - (NSInteger)getIntervalsWithTimeStamp:(NSInteger)timeStamp {
  137. return [[NSDate date] timeIntervalSinceDate:[self getDateWithTimeStamp:timeStamp]];
  138. }
  139. // 根据时间和formatter获取时间字符串
  140. - (NSString *)getTimeStrWithDate:(NSDate *)date formatter:(NSString *)formatterStr {
  141. NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
  142. // NSTimeZone *zone = [NSTimeZone systemTimeZone];
  143. // NSInteger interval = [zone secondsFromGMTForDate: date];
  144. // NSDate *localeDate = [date dateByAddingTimeInterval: interval];
  145. [formatter setDateFormat:formatterStr];
  146. NSString *dateStr = [formatter stringFromDate:date];
  147. return dateStr;
  148. }
  149. // 根据时间字符串和formatter获取时间戳(s)
  150. - (NSInteger)getTimeStampWithTimeStr:(NSString *)timeStr formatter:(NSString *)formatterStr {
  151. NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
  152. [formatter setDateFormat:formatterStr];
  153. return [self getTimeStampWithDate:[formatter dateFromString:timeStr]] * 0.001 * 0.001;
  154. }
  155. // 一个时间戳与另一个时间戳的间隔(s)
  156. - (NSInteger)getIntervalsWithTimeStamp:(NSInteger)timeStamp anotherTimeStamp:(NSInteger)anotherTimeStamp {
  157. return [[self getDateWithTimeStamp:timeStamp] timeIntervalSinceDate:[self getDateWithTimeStamp:anotherTimeStamp]] * 0.001 * 0.001;
  158. }
  159. #pragma mark - RQAlertViewController
  160. - (void)showAlertAtViewController:(nonnull UIViewController *)viewController
  161. WithTitle:(nullable NSString *)title
  162. message:(nullable NSString *)message
  163. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  164. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  165. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  166. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  167. preferredActionTitle:(nullable NSString *)preferredActionTitle
  168. completion:(nullable RQAlertViewCompletion)completion {
  169. __block UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:alertControllerStyle];
  170. void (^alertActionHandler) (UIAlertAction *) = [^(UIAlertAction *action) {
  171. if (completion) {
  172. if (action.style == UIAlertActionStyleCancel) {
  173. completion(NSNotFound);
  174. }else {
  175. NSUInteger index = [alertController.actions indexOfObject:action];
  176. completion(cancelButtonTitle? index - 1 : index);
  177. }
  178. }
  179. alertController = nil;
  180. } copy];
  181. if (cancelButtonTitle) {
  182. UIAlertAction *cancleAction = [UIAlertAction actionWithTitle:cancelButtonTitle style:UIAlertActionStyleCancel handler:alertActionHandler];
  183. if (@available(iOS 9.0, *)) {
  184. [cancleAction setValue:defGreen forKey:@"_titleTextColor"];
  185. } else {
  186. // Fallback on earlier versions
  187. }
  188. [alertController addAction:cancleAction];
  189. }
  190. if (otherButtonTitles.count == 0) {
  191. dispatch_async(dispatch_get_main_queue(), ^{
  192. [[RQ_SHARE_FUNCTION topViewController] presentViewController:alertController animated:YES completion:nil];
  193. });
  194. }else {
  195. [otherButtonTitles.rac_sequence.signal subscribeNext:^(NSString * buttonTitle) {
  196. NSNumber *actionStyleNumber = [otherButtonStyles valueForKey:buttonTitle];
  197. UIAlertActionStyle actionStyle = UIAlertActionStyleDefault;
  198. if (actionStyleNumber) {
  199. actionStyle = [actionStyleNumber integerValue];
  200. }
  201. UIAlertAction *action = [UIAlertAction actionWithTitle:buttonTitle
  202. style:actionStyle
  203. handler:alertActionHandler];
  204. if (@available(iOS 9.0, *)) {
  205. [action setValue:defGreen forKey:@"_titleTextColor"];
  206. } else {
  207. // Fallback on earlier versions
  208. }
  209. [alertController addAction:action];
  210. ///Support for iOS9 add preferredAction for highlights the text of that action
  211. if ([alertController respondsToSelector:@selector(setPreferredAction:)]) {
  212. if ([preferredActionTitle isEqualToString:buttonTitle]) {
  213. if (@available(iOS 9.0, *)) {
  214. [alertController setPreferredAction:action];
  215. } else {
  216. // Fallback on earlier versions
  217. }
  218. }
  219. }
  220. } completed:^{
  221. dispatch_async(dispatch_get_main_queue(), ^{
  222. [[RQ_SHARE_FUNCTION topViewController] presentViewController:alertController animated:YES completion:nil];
  223. });
  224. }];
  225. }
  226. }
  227. - (void)showAlertWithTitle:(nullable NSString *)title
  228. message:(nullable NSString *)message
  229. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  230. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  231. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  232. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  233. preferredActionTitle:(nullable NSString *)preferredActionTitle
  234. completion:(nullable RQAlertViewCompletion)completion{
  235. [self showAlertAtViewController:[RQ_SHARE_FUNCTION topViewController]
  236. WithTitle:title
  237. message:message
  238. alertControllerStyle:alertControllerStyle
  239. cancelButtonTitle:cancelButtonTitle
  240. otherButtonTitles:otherButtonTitles
  241. otherButtonStyles:otherButtonStyles
  242. preferredActionTitle:preferredActionTitle
  243. completion:completion];
  244. }
  245. - (void)showAlertWithTitle:(nullable NSString *)title
  246. message:(nullable NSString *)message
  247. alertControllerStyle:(UIAlertControllerStyle)alertControllerStyle
  248. cancelButtonTitle:(nullable NSString *)cancelButtonTitle
  249. otherButtonTitles:(nullable NSArray *)otherButtonTitles
  250. otherButtonStyles:(nullable NSDictionary *)otherButtonStyles
  251. completion:(nullable RQAlertViewCompletion)completion {
  252. [self showAlertAtViewController:[RQ_SHARE_FUNCTION topViewController]
  253. WithTitle:title
  254. message:message
  255. alertControllerStyle:alertControllerStyle
  256. cancelButtonTitle:cancelButtonTitle
  257. otherButtonTitles:otherButtonTitles
  258. otherButtonStyles:otherButtonStyles
  259. preferredActionTitle:nil
  260. completion:completion];
  261. }
  262. - (void)showAlertWithMessage:(nullable NSString *)message
  263. completion:(nullable RQAlertViewCompletion)completion {
  264. [self showAlertAtViewController:[RQ_SHARE_FUNCTION topViewController]
  265. WithTitle:@""
  266. message:message
  267. alertControllerStyle:UIAlertControllerStyleAlert
  268. cancelButtonTitle:@"确定"
  269. otherButtonTitles:nil
  270. otherButtonStyles:nil
  271. preferredActionTitle:nil
  272. completion:completion];
  273. }
  274. #pragma mark - Custom Way
  275. - (UIViewController *)topViewController {
  276. return [RQ_SHARE_FUNCTION topViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
  277. }
  278. - (UIViewController *)topViewController:(UIViewController*)rootViewController {
  279. if (rootViewController.presentedViewController == nil ||
  280. rootViewController.presentedViewController.beingDismissed) {
  281. return rootViewController;
  282. }
  283. if ([rootViewController.presentedViewController isMemberOfClass:[UINavigationController class]]) {
  284. UINavigationController *navigationController = (UINavigationController *)rootViewController.presentedViewController;
  285. UIViewController *lastViewController = [[navigationController viewControllers] lastObject];
  286. return [RQ_SHARE_FUNCTION topViewController:lastViewController];
  287. }
  288. UIViewController *presentedViewController = (UIViewController *)rootViewController.presentedViewController;
  289. return [RQ_SHARE_FUNCTION topViewController:presentedViewController];
  290. }
  291. - (UIViewController *)currentViewController {
  292. UIViewController *resultVC;
  293. resultVC = [self _topViewController:[[UIApplication sharedApplication].keyWindow rootViewController]];
  294. while (resultVC.presentedViewController) {
  295. resultVC = [self _topViewController:resultVC.presentedViewController];
  296. }
  297. return resultVC;
  298. }
  299. - (UIViewController *)_topViewController:(UIViewController *)vc {
  300. if ([vc isKindOfClass:[UINavigationController class]]) {
  301. return [self _topViewController:[(UINavigationController *)vc topViewController]];
  302. } else if ([vc isKindOfClass:[UITabBarController class]]) {
  303. return [self _topViewController:[(UITabBarController *)vc selectedViewController]];
  304. } else {
  305. return vc;
  306. }
  307. }
  308. - (NSData *)compressQualityWithImage:(UIImage *)image MaxLength:(NSInteger)maxLength {
  309. CGFloat compression = 1;
  310. NSData *data = UIImageJPEGRepresentation(image, compression);
  311. if (data.length < maxLength) return data;
  312. CGFloat max = 1;
  313. CGFloat min = 0;
  314. NSData *lastData;
  315. for (int i = 0; i < 99; ++i) {
  316. compression = (max + min) / 2;
  317. data = UIImageJPEGRepresentation(image, compression);
  318. if (data.length == lastData.length) {
  319. return data;
  320. }else {
  321. lastData = data;
  322. }
  323. if (data.length < maxLength * 0.9) {
  324. min = compression;
  325. } else if (data.length > maxLength) {
  326. max = compression;
  327. } else {
  328. break;
  329. }
  330. }
  331. return data;
  332. }
  333. - (void)showGuidePicture {
  334. UIButton* btn = [[UIButton alloc] initWithFrame:kFrame];
  335. [myDelegate.window addSubview:btn];
  336. [btn setImage:[UIImage imageNamed:@"welGuide2.png"] forState:UIControlStateNormal];
  337. UIImageView* iv;
  338. iv = [[UIImageView alloc] initWithFrame:CGRectMake(3, 11, 70, 70)];
  339. [iv setImage:[UIImage imageNamed:@"welGuide1.png"]];
  340. [btn addSubview:iv];
  341. [btn addTarget:self action:@selector(removeBtn:) forControlEvents:UIControlEventTouchUpInside];
  342. }
  343. - (void)removeBtn:(UIButton *)btn {
  344. [btn removeFromSuperview];
  345. }
  346. #pragma mark - 检查版本更新
  347. - (void)checkVersion {
  348. /// 在当前页面有弹窗 以及在模拟计时页面 理论计时页面 模拟考试界面 不弹出更新提示
  349. NSArray *controllers = @[@"UIAlertController", @"ExerciseVC", @"ImitatePeriodVC", @"PeriodVC"];
  350. NSLog(@"string---Class-----%@",NSStringFromClass([RQ_SHARE_FUNCTION currentViewController].class));
  351. if ([controllers containsObject:NSStringFromClass([RQ_SHARE_FUNCTION currentViewController].class)]) {
  352. return;
  353. }
  354. if (![Util connectedToNetWork]) {
  355. return;
  356. }
  357. NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
  358. NSString *localVersion = [infoDic objectForKey:@"CFBundleShortVersionString"];
  359. NSString *URL = @"http://itunes.apple.com/cn/lookup?id=1214200225";
  360. NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:URL] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:10];
  361. [request setHTTPMethod:@"POST"];
  362. NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
  363. //这个导致部分手机网络不好时候出现闪退情况
  364. if (!data) {
  365. return;
  366. }
  367. //如果data等于nil的时候 再去解析 会发生崩溃
  368. NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
  369. if (!dic) {
  370. return;
  371. }
  372. NSArray *infoArray = [dic objectForKey:@"results"];
  373. if ([infoArray count]) {
  374. NSDictionary *releaseInfo = [infoArray objectAtIndex:0];
  375. NSString *netVersion = [releaseInfo objectForKey:@"version"];
  376. //NSLog(@"AppStore-->%@,手机上-->%@",lastVersion,currentVersion);
  377. // 线上版本号
  378. NSInteger netInt = [[netVersion stringByReplacingOccurrencesOfString:@"." withString:@""] integerValue];
  379. // 本地版本号
  380. NSInteger localInt = [[localVersion stringByReplacingOccurrencesOfString:@"." withString:@""] integerValue];
  381. if (netInt > localInt) {
  382. NSLog(@"更新");
  383. [RQ_SHARE_FUNCTION showAlertWithTitle:@"更新提示" message:[NSString stringWithFormat:@"本地版本为%@\nApp Store已发布%@\n请及时更新!",localVersion,netVersion] alertControllerStyle:UIAlertControllerStyleAlert cancelButtonTitle:nil otherButtonTitles:@[@"确定"] otherButtonStyles:nil completion:^(NSUInteger selectedOtherButtonIndex) {
  384. if (selectedOtherButtonIndex == 0) {
  385. NSURL *url = [NSURL URLWithString:@"itms-apps://itunes.apple.com/cn/app/ji-su-jia-pei-kua-jia-xiao-ban/id1214200225?l=en&mt=8"];
  386. [[UIApplication sharedApplication] openURL:url];
  387. }
  388. }];
  389. }else{
  390. //已是最新版
  391. NSLog(@"不更");
  392. }
  393. }
  394. }];
  395. [task resume];
  396. }
  397. - (void)saveObjectWithObject:(id)object ForKey:(NSString* )key {
  398. NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
  399. if (!object) {
  400. [ud removeObjectForKey:key];
  401. }else{
  402. [ud setObject:object forKey:key];
  403. }
  404. [ud synchronize];
  405. }
  406. - (id)getObjectWithKey:(NSString *)key {
  407. NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
  408. return [ud objectForKey:key];
  409. }
  410. // 检测抓包
  411. - (BOOL)checkProxySetting {
  412. NSDictionary *proxySettings = (__bridge NSDictionary *)(CFNetworkCopySystemProxySettings());
  413. NSArray *proxies = (__bridge NSArray *)(CFNetworkCopyProxiesForURL((__bridge CFURLRef _Nonnull)([NSURL URLWithString:@"https://www.baidu.com"]), (__bridge CFDictionaryRef _Nonnull)(proxySettings)));
  414. NSLog(@"\n%@",proxies);
  415. NSDictionary *settings = proxies[0];
  416. NSLog(@"%@",[settings objectForKey:(NSString *)kCFProxyHostNameKey]);
  417. NSLog(@"%@",[settings objectForKey:(NSString *)kCFProxyPortNumberKey]);
  418. NSLog(@"%@",[settings objectForKey:(NSString *)kCFProxyTypeKey]);
  419. if ([[settings objectForKey:(NSString *)kCFProxyTypeKey] isEqualToString:@"kCFProxyTypeNone"]) {
  420. NSLog(@"没设置代理");
  421. return NO;
  422. } else {
  423. NSLog(@"设置了代理");
  424. return YES;
  425. }
  426. }
  427. @end