From ab9a59d00a3582a97659d2b7d8c8f740bb156cbe Mon Sep 17 00:00:00 2001 From: fengong Date: Sat, 15 Jun 2019 14:36:38 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=A8=A1=E6=8B=9F=E5=99=A8=E4=B8=AD?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=B7=AF=E5=BE=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SGDownload/Classes/SGDownloadTools.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SGDownload/Classes/SGDownloadTools.m b/SGDownload/Classes/SGDownloadTools.m index 1ebd8b9..a091129 100644 --- a/SGDownload/Classes/SGDownloadTools.m +++ b/SGDownload/Classes/SGDownloadTools.m @@ -44,7 +44,11 @@ + (NSString *)replacehHomeDirectoryForFilePath:(NSString *)filePath NSError * error; NSRegularExpression * regex = [NSRegularExpression regularExpressionWithPattern:@"(\\w*-){4}(\\w*)" options:0 error:&error]; if (!error) { +#if !defined(TARGET_OS_SIMULATOR) || TARGET_OS_SIMULATOR + NSTextCheckingResult * match =[regex matchesInString:filePath options:NSMatchingReportCompletion range:NSMakeRange(0, filePath.length)].lastObject; +#else NSTextCheckingResult * match = [regex firstMatchInString:filePath options:0 range:NSMakeRange(0, filePath.length)]; +#endif if (match) { NSString * currentName = NSHomeDirectory().lastPathComponent; filePath = [filePath stringByReplacingCharactersInRange:match.range withString:currentName]; From 92e6c7aca1d494aec7a136d9b841caa4aeaaa904 Mon Sep 17 00:00:00 2001 From: fengong Date: Sat, 15 Jun 2019 15:22:09 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=98=B2=E6=AD=A2=E5=AD=90=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E4=BB=A5=20UUID=20=E5=BD=A2=E5=BC=8F=E5=91=BD?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SGDownload/Classes/SGDownloadTools.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SGDownload/Classes/SGDownloadTools.m b/SGDownload/Classes/SGDownloadTools.m index a091129..409f37e 100644 --- a/SGDownload/Classes/SGDownloadTools.m +++ b/SGDownload/Classes/SGDownloadTools.m @@ -45,7 +45,8 @@ + (NSString *)replacehHomeDirectoryForFilePath:(NSString *)filePath NSRegularExpression * regex = [NSRegularExpression regularExpressionWithPattern:@"(\\w*-){4}(\\w*)" options:0 error:&error]; if (!error) { #if !defined(TARGET_OS_SIMULATOR) || TARGET_OS_SIMULATOR - NSTextCheckingResult * match =[regex matchesInString:filePath options:NSMatchingReportCompletion range:NSMakeRange(0, filePath.length)].lastObject; + NSArray *results =[regex matchesInString:filePath options:NSMatchingReportCompletion range:NSMakeRange(0, filePath.length)]; + NSTextCheckingResult * match = results[1]; #else NSTextCheckingResult * match = [regex firstMatchInString:filePath options:0 range:NSMakeRange(0, filePath.length)]; #endif