Skip to content

Commit

Permalink
Remove auto check version.
Browse files Browse the repository at this point in the history
FIXED #96
  • Loading branch information
HDB-Li committed Jun 7, 2020
1 parent b0ad72f commit ad38ad7
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions LLDebugToolDemo/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -145,30 +145,12 @@ - (void)doNetwork {
}];

//NSURLSession
NSMutableURLRequest *htmlRequest = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"https://cocoapods.org/pods/LLDebugTool"]];
NSMutableURLRequest *htmlRequest = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"https://www.baidu.com"]];
[htmlRequest setHTTPMethod:@"GET"];
NSURLSessionDataTask *dataTask = [[NetTool shared]
.session dataTaskWithRequest:htmlRequest
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
// Not important. Just check to see if the current Demo version is consistent with the latest version.
// 只是检查一下当前Demo版本和最新版本是否一致,不一致就提示一下新版本。
NSString *htmlString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSArray *array = [htmlString componentsSeparatedByString:@"http://cocoadocs.org/docsets/LLDebugTool/"];
if (array.count > 2) {
NSString *str = array[1];
NSArray *array2 = [str componentsSeparatedByString:@"/preview.png"];
if (array2.count >= 2) {
NSString *newVersion = array2[0];
if ([newVersion componentsSeparatedByString:@"."].count == 3) {
if ([[LLDebugTool versionNumber] compare:newVersion] == NSOrderedAscending) {
UIAlertController *vc = [UIAlertController alertControllerWithTitle:@"Note" message:[NSString stringWithFormat:@"%@\nNew Version : %@\nCurrent Version : %@", NSLocalizedString(@"new.version", nil), newVersion, [LLDebugTool versionNumber]] preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *action = [UIAlertAction actionWithTitle:@"I known" style:UIAlertActionStyleDefault handler:nil];
[vc addAction:action];
[self presentViewController:vc animated:YES completion:nil];
}
}
}
}
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error){

}];
[dataTask resume];
}
Expand Down

0 comments on commit ad38ad7

Please sign in to comment.