@@ -145,30 +145,12 @@ - (void)doNetwork {
145145 }];
146146
147147 // NSURLSession
148- NSMutableURLRequest *htmlRequest = [[NSMutableURLRequest alloc ] initWithURL: [NSURL URLWithString: @" https://cocoapods.org/pods/LLDebugTool " ]];
148+ NSMutableURLRequest *htmlRequest = [[NSMutableURLRequest alloc ] initWithURL: [NSURL URLWithString: @" https://www.baidu.com " ]];
149149 [htmlRequest setHTTPMethod: @" GET" ];
150150 NSURLSessionDataTask *dataTask = [[NetTool shared ]
151151 .session dataTaskWithRequest: htmlRequest
152- completionHandler: ^(NSData *data, NSURLResponse *response, NSError *error) {
153- // Not important. Just check to see if the current Demo version is consistent with the latest version.
154- // 只是检查一下当前Demo版本和最新版本是否一致,不一致就提示一下新版本。
155- NSString *htmlString = [[NSString alloc ] initWithData: data encoding: NSUTF8StringEncoding];
156- NSArray *array = [htmlString componentsSeparatedByString: @" http://cocoadocs.org/docsets/LLDebugTool/" ];
157- if (array.count > 2 ) {
158- NSString *str = array[1 ];
159- NSArray *array2 = [str componentsSeparatedByString: @" /preview.png" ];
160- if (array2.count >= 2 ) {
161- NSString *newVersion = array2[0 ];
162- if ([newVersion componentsSeparatedByString: @" ." ].count == 3 ) {
163- if ([[LLDebugTool versionNumber ] compare: newVersion] == NSOrderedAscending) {
164- UIAlertController *vc = [UIAlertController alertControllerWithTitle: @" Note" message: [NSString stringWithFormat: @" %@ \n New Version : %@ \n Current Version : %@ " , NSLocalizedString(@" new.version" , nil ), newVersion, [LLDebugTool versionNumber ]] preferredStyle: UIAlertControllerStyleAlert];
165- UIAlertAction *action = [UIAlertAction actionWithTitle: @" I known" style: UIAlertActionStyleDefault handler: nil ];
166- [vc addAction: action];
167- [self presentViewController: vc animated: YES completion: nil ];
168- }
169- }
170- }
171- }
152+ completionHandler: ^(NSData *data, NSURLResponse *response, NSError *error){
153+
172154 }];
173155 [dataTask resume ];
174156}
0 commit comments