Skip to content

Commit 2834feb

Browse files
committed
merge master
2 parents 2e5b9b7 + 0e7d30c commit 2834feb

24 files changed

+1078
-131
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#Changelog
22

3+
## 7.2.6 (2019-09-24)
4+
## 修正
5+
* PHAsset iOS 13 支持
6+
37
## 7.2.5 (2018-08-16)
48
## 修正
59
* Form上传配置filename

Qiniu.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'Qiniu'
3-
s.version = '7.2.5'
3+
s.version = '7.2.6'
44
s.summary = 'Qiniu Resource Storage SDK for iOS and Mac'
55
s.homepage = 'https://github.com/qiniu/objc-sdk'
66
s.social_media_url = 'http://weibo.com/qiniutek'

QiniuSDK.xcodeproj/project.pbxproj

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@
2525
CC3F322622C0CCDF00F23681 /* QNUploadInfoReporter.m in Sources */ = {isa = PBXBuildFile; fileRef = CC3F322222C0CCDF00F23681 /* QNUploadInfoReporter.m */; };
2626
CC4B347522C496A800130D51 /* QNReporterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CC4B347422C496A800130D51 /* QNReporterTest.m */; };
2727
CC4B347622C496A800130D51 /* QNReporterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CC4B347422C496A800130D51 /* QNReporterTest.m */; };
28-
CC4B347722C4995100130D51 /* QiniuSDK.h in Headers */ = {isa = PBXBuildFile; fileRef = DF2CDE5819DAC6A400CE01FB /* QiniuSDK.h */; };
28+
CCC3A50822DC10CB00D835B1 /* QNConcurrentResumeUpload.h in Headers */ = {isa = PBXBuildFile; fileRef = CCC3A50622DC10CB00D835B1 /* QNConcurrentResumeUpload.h */; };
29+
CCC3A50922DC10CB00D835B1 /* QNConcurrentResumeUpload.m in Sources */ = {isa = PBXBuildFile; fileRef = CCC3A50722DC10CB00D835B1 /* QNConcurrentResumeUpload.m */; };
30+
CCC3A50A22DC10CB00D835B1 /* QNConcurrentResumeUpload.m in Sources */ = {isa = PBXBuildFile; fileRef = CCC3A50722DC10CB00D835B1 /* QNConcurrentResumeUpload.m */; };
31+
CCF661062355C2C00018A41E /* QNConcurrentResumeUploadTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CCF661052355C2C00018A41E /* QNConcurrentResumeUploadTest.m */; };
32+
CCF661072355C4480018A41E /* QNConcurrentResumeUploadTest.m in Sources */ = {isa = PBXBuildFile; fileRef = CCF661052355C2C00018A41E /* QNConcurrentResumeUploadTest.m */; };
33+
CCF661082355C5120018A41E /* QiniuSDK.h in Headers */ = {isa = PBXBuildFile; fileRef = DF2CDE5819DAC6A400CE01FB /* QiniuSDK.h */; };
2934
DF0A03231B3BABEC00E3778C /* QiniuSDK_Mac.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = DF2CDDFF19DAC05500CE01FB /* QiniuSDK_Mac.dylib */; };
3035
DF0A03241B3BAC3900E3778C /* QNFormUploadTest.m in Sources */ = {isa = PBXBuildFile; fileRef = DF3C504619DD7BA6000F548F /* QNFormUploadTest.m */; };
3136
DF0A03251B3BAC5700E3778C /* libQiniuSDK_iOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DF2CDE1A19DAC08400CE01FB /* libQiniuSDK_iOS.a */; };
@@ -151,7 +156,9 @@
151156
CC3F321B22C0CC3700F23681 /* QNReportConfig.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QNReportConfig.m; sourceTree = "<group>"; };
152157
CC3F322122C0CCDF00F23681 /* QNUploadInfoReporter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QNUploadInfoReporter.h; sourceTree = "<group>"; };
153158
CC3F322222C0CCDF00F23681 /* QNUploadInfoReporter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QNUploadInfoReporter.m; sourceTree = "<group>"; };
154-
CC4B347422C496A800130D51 /* QNReporterTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QNReporterTest.m; sourceTree = "<group>"; };
159+
CCC3A50622DC10CB00D835B1 /* QNConcurrentResumeUpload.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QNConcurrentResumeUpload.h; sourceTree = "<group>"; };
160+
CCC3A50722DC10CB00D835B1 /* QNConcurrentResumeUpload.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QNConcurrentResumeUpload.m; sourceTree = "<group>"; };
161+
CCF661052355C2C00018A41E /* QNConcurrentResumeUploadTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = QNConcurrentResumeUploadTest.m; sourceTree = "<group>"; };
155162
D84AF95CA892E1089E26F959 /* Pods-QiniuSDK_iOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-QiniuSDK_iOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-QiniuSDK_iOS/Pods-QiniuSDK_iOS.release.xcconfig"; sourceTree = "<group>"; };
156163
DF0D23CC19DCE6C400D6B68F /* QNResponseInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QNResponseInfo.h; sourceTree = "<group>"; };
157164
DF0D23CE19DCE6E500D6B68F /* QNResponseInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QNResponseInfo.m; sourceTree = "<group>"; };
@@ -291,7 +298,7 @@
291298
name = Frameworks;
292299
sourceTree = "<group>";
293300
};
294-
CC3F320922C0AAB800F23681 /* Recovered References */ = {
301+
CCC3A50522DC0CFF00D835B1 /* Recovered References */ = {
295302
isa = PBXGroup;
296303
children = (
297304
DF293C9019DB85CB00799011 /* libz.dylib */,
@@ -321,7 +328,7 @@
321328
DF2CDE0019DAC05500CE01FB /* Products */,
322329
A955AABD20BF51BFE5032419 /* Frameworks */,
323330
15E6E080F2F167B7B3D5F460 /* Pods */,
324-
CC3F320922C0AAB800F23681 /* Recovered References */,
331+
CCC3A50522DC0CFF00D835B1 /* Recovered References */,
325332
);
326333
sourceTree = "<group>";
327334
};
@@ -385,6 +392,8 @@
385392
DF2CDE5B19DAC6A400CE01FB /* QNUploadManager.m */,
386393
DF293CA819DC0AF000799011 /* QNResumeUpload.h */,
387394
DF293CAA19DC0E5300799011 /* QNResumeUpload.m */,
395+
CCC3A50622DC10CB00D835B1 /* QNConcurrentResumeUpload.h */,
396+
CCC3A50722DC10CB00D835B1 /* QNConcurrentResumeUpload.m */,
388397
DFA9B64719E0018800A15FD1 /* QNUploadOption.h */,
389398
DFA9B64819E0018800A15FD1 /* QNUploadOption.m */,
390399
DF609A031A58E39D00AC7297 /* QNFormUpload.h */,
@@ -409,6 +418,7 @@
409418
DF293C9619DB865800799011 /* QNCrc32Test.m */,
410419
DF3C504619DD7BA6000F548F /* QNFormUploadTest.m */,
411420
DF3C504919DD7D9F000F548F /* QNResumeUploadTest.m */,
421+
CCF661052355C2C00018A41E /* QNConcurrentResumeUploadTest.m */,
412422
DFA9B63E19DFD8C900A15FD1 /* QNEtagTest.m */,
413423
DFA9B64319DFE43500A15FD1 /* QNTempFile.h */,
414424
DFA9B64419DFE43500A15FD1 /* QNTempFile.m */,
@@ -461,12 +471,14 @@
461471
DFA9B65819E0B53700A15FD1 /* QNFileRecorder.h in Headers */,
462472
DFF126EE1B63909A0005C39C /* QNFileDelegate.h in Headers */,
463473
DF482FD81B0DA8A2000DAD98 /* QNConfiguration.h in Headers */,
474+
CCC3A50822DC10CB00D835B1 /* QNConcurrentResumeUpload.h in Headers */,
464475
DF609A051A58E39D00AC7297 /* QNFormUpload.h in Headers */,
465476
DFF525371A626A3700D02BA1 /* QNHttpDelegate.h in Headers */,
466477
93CEF47E1BDE11FF00750FE8 /* QNPHAssetFile.h in Headers */,
467478
DF2CDE6019DAC6A400CE01FB /* QNCrc32.h in Headers */,
468479
CC3F322322C0CCDF00F23681 /* QNUploadInfoReporter.h in Headers */,
469480
DFF126F11B639F3B0005C39C /* QNFile.h in Headers */,
481+
CCF661082355C5120018A41E /* QiniuSDK.h in Headers */,
470482
DFA9B63B19DF904000A15FD1 /* QNEtag.h in Headers */,
471483
CC3F321C22C0CC3700F23681 /* QNReportConfig.h in Headers */,
472484
DF2CDE5C19DAC6A400CE01FB /* QNUrlSafeBase64.h in Headers */,
@@ -704,6 +716,7 @@
704716
DF437CD31B2426270099587B /* QN_GTM_Base64.m in Sources */,
705717
DF482FD91B0DA8A2000DAD98 /* QNConfiguration.m in Sources */,
706718
DF609A061A58E39D00AC7297 /* QNFormUpload.m in Sources */,
719+
CCC3A50922DC10CB00D835B1 /* QNConcurrentResumeUpload.m in Sources */,
707720
FDEA5C001F27A27700D9D731 /* QNPipeline.m in Sources */,
708721
DF293C9F19DBC2AE00799011 /* QNUserAgent.m in Sources */,
709722
DFA9B65919E0B53700A15FD1 /* QNFileRecorder.m in Sources */,
@@ -731,7 +744,7 @@
731744
DF437CDF1B243A2C0099587B /* QNUpTokenTest.m in Sources */,
732745
DF3C504A19DD7D9F000F548F /* QNResumeUploadTest.m in Sources */,
733746
DF293C9719DB865800799011 /* QNCrc32Test.m in Sources */,
734-
CC4B347522C496A800130D51 /* QNReporterTest.m in Sources */,
747+
CCF661062355C2C00018A41E /* QNConcurrentResumeUploadTest.m in Sources */,
735748
FD4FEE441F298D58003A38B8 /* QNPipelineTest.m in Sources */,
736749
DFA9B64519DFE43500A15FD1 /* QNTempFile.m in Sources */,
737750
DFF525391A64079B00D02BA1 /* QNSessionTest.m in Sources */,
@@ -753,6 +766,7 @@
753766
DF0D23D019DCE6E500D6B68F /* QNResponseInfo.m in Sources */,
754767
DFA9B63D19DF904000A15FD1 /* QNEtag.m in Sources */,
755768
DF437CD51B2426270099587B /* QN_GTM_Base64.m in Sources */,
769+
CCC3A50A22DC10CB00D835B1 /* QNConcurrentResumeUpload.m in Sources */,
756770
FDEA5C011F27A27700D9D731 /* QNPipeline.m in Sources */,
757771
DF482FDA1B0DA8A2000DAD98 /* QNConfiguration.m in Sources */,
758772
DF609A081A58E39D00AC7297 /* QNFormUpload.m in Sources */,
@@ -780,7 +794,7 @@
780794
DF0A03281B3BAC6E00E3778C /* QNFormUploadTest.m in Sources */,
781795
DF0A03291B3BAC6E00E3778C /* QNResumeUploadTest.m in Sources */,
782796
DF0A032B1B3BAC6E00E3778C /* QNEtagTest.m in Sources */,
783-
CC4B347622C496A800130D51 /* QNReporterTest.m in Sources */,
797+
CCF661072355C4480018A41E /* QNConcurrentResumeUploadTest.m in Sources */,
784798
FD4FEE451F298D58003A38B8 /* QNPipelineTest.m in Sources */,
785799
DF0A032C1B3BAC6E00E3778C /* QNTempFile.m in Sources */,
786800
DF0A032D1B3BAC6E00E3778C /* QNFileRecorderTest.m in Sources */,

QiniuSDK.xcodeproj/xcshareddata/xcschemes/QiniuSDK_Mac.xcscheme

100755100644
Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0730"
3+
LastUpgradeVersion = "1100"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -26,7 +26,6 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29-
language = ""
3029
shouldUseLaunchSchemeArgsEnv = "YES">
3130
<Testables>
3231
<TestableReference
@@ -40,20 +39,24 @@
4039
</BuildableReference>
4140
</TestableReference>
4241
</Testables>
43-
<AdditionalOptions>
44-
</AdditionalOptions>
4542
</TestAction>
4643
<LaunchAction
47-
buildConfiguration = "Release"
44+
buildConfiguration = "Debug"
4845
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4946
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
50-
language = ""
5147
launchStyle = "0"
5248
useCustomWorkingDirectory = "NO"
5349
ignoresPersistentStateOnLaunch = "NO"
5450
debugDocumentVersioning = "YES"
5551
debugServiceExtension = "internal"
5652
allowLocationSimulation = "YES">
53+
</LaunchAction>
54+
<ProfileAction
55+
buildConfiguration = "Release"
56+
shouldUseLaunchSchemeArgsEnv = "YES"
57+
savedToolIdentifier = ""
58+
useCustomWorkingDirectory = "NO"
59+
debugDocumentVersioning = "YES">
5760
<MacroExpansion>
5861
<BuildableReference
5962
BuildableIdentifier = "primary"
@@ -63,15 +66,6 @@
6366
ReferencedContainer = "container:QiniuSDK.xcodeproj">
6467
</BuildableReference>
6568
</MacroExpansion>
66-
<AdditionalOptions>
67-
</AdditionalOptions>
68-
</LaunchAction>
69-
<ProfileAction
70-
buildConfiguration = "Release"
71-
shouldUseLaunchSchemeArgsEnv = "YES"
72-
savedToolIdentifier = ""
73-
useCustomWorkingDirectory = "NO"
74-
debugDocumentVersioning = "YES">
7569
</ProfileAction>
7670
<AnalyzeAction
7771
buildConfiguration = "Debug">

QiniuSDK.xcodeproj/xcshareddata/xcschemes/QiniuSDK_iOS.xcscheme

100755100644
Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
2929
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<MacroExpansion>
31+
<BuildableReference
32+
BuildableIdentifier = "primary"
33+
BlueprintIdentifier = "DF2CDE1919DAC08400CE01FB"
34+
BuildableName = "libQiniuSDK_iOS.a"
35+
BlueprintName = "QiniuSDK_iOS"
36+
ReferencedContainer = "container:QiniuSDK.xcodeproj">
37+
</BuildableReference>
38+
</MacroExpansion>
3039
<Testables>
3140
<TestableReference
3241
skipped = "NO">
@@ -39,17 +48,6 @@
3948
</BuildableReference>
4049
</TestableReference>
4150
</Testables>
42-
<MacroExpansion>
43-
<BuildableReference
44-
BuildableIdentifier = "primary"
45-
BlueprintIdentifier = "DF2CDE1919DAC08400CE01FB"
46-
BuildableName = "libQiniuSDK_iOS.a"
47-
BlueprintName = "QiniuSDK_iOS"
48-
ReferencedContainer = "container:QiniuSDK.xcodeproj">
49-
</BuildableReference>
50-
</MacroExpansion>
51-
<AdditionalOptions>
52-
</AdditionalOptions>
5351
</TestAction>
5452
<LaunchAction
5553
buildConfiguration = "Release"
@@ -70,8 +68,6 @@
7068
ReferencedContainer = "container:QiniuSDK.xcodeproj">
7169
</BuildableReference>
7270
</MacroExpansion>
73-
<AdditionalOptions>
74-
</AdditionalOptions>
7571
</LaunchAction>
7672
<ProfileAction
7773
buildConfiguration = "Release"

QiniuSDK/BigData/QNPipeline.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ - (void)pumpRepo:(NSString*)repo
132132
handler:(QNPipelineCompletionHandler)handler {
133133
NSDictionary* headers = @{ @"Authorization" : token,
134134
@"Content-Type" : @"text/plain" };
135-
[_httpManager post:[self url:repo] withData:[str dataUsingEncoding:NSUTF8StringEncoding] withParams:nil withHeaders:headers withCompleteBlock:^(QNResponseInfo* info, NSDictionary* resp) {
135+
[_httpManager post:[self url:repo] withData:[str dataUsingEncoding:NSUTF8StringEncoding] withParams:nil withHeaders:headers withTaskIdentifier:nil withCompleteBlock:^(QNResponseInfo* info, NSDictionary* resp) {
136136
handler(info);
137137
}
138138
withProgressBlock:nil

QiniuSDK/Common/QNALAssetFile.m

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ @interface QNALAssetFile ()
2121

2222
@property (readonly) int64_t fileModifyTime;
2323

24+
@property (nonatomic, strong) NSLock *lock;
25+
2426
@end
2527

2628
@implementation QNALAssetFile
@@ -35,22 +37,34 @@ - (instancetype)init:(ALAsset *)asset
3537
_fileModifyTime = t;
3638
_fileSize = asset.defaultRepresentation.size;
3739
_asset = asset;
40+
_lock = [[NSLock alloc] init];
3841
}
3942

4043
return self;
4144
}
4245

4346
- (NSData *)read:(long)offset
44-
size:(long)size {
45-
ALAssetRepresentation *rep = [self.asset defaultRepresentation];
46-
Byte *buffer = (Byte *)malloc(size);
47-
NSUInteger buffered = [rep getBytes:buffer fromOffset:offset length:size error:nil];
48-
49-
return [NSData dataWithBytesNoCopy:buffer length:buffered freeWhenDone:YES];
47+
size:(long)size
48+
error:(NSError **)error {
49+
50+
NSData *data = nil;
51+
@try {
52+
[_lock lock];
53+
ALAssetRepresentation *rep = [self.asset defaultRepresentation];
54+
Byte *buffer = (Byte *)malloc(size);
55+
NSUInteger buffered = [rep getBytes:buffer fromOffset:offset length:size error:error];
56+
data = [NSData dataWithBytesNoCopy:buffer length:buffered freeWhenDone:YES];
57+
} @catch (NSException *exception) {
58+
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:kQNFileError userInfo:@{NSLocalizedDescriptionKey : exception.reason}];
59+
NSLog(@"read file failed reason: %@ \n%@", exception.reason, exception.callStackSymbols);
60+
} @finally {
61+
[_lock unlock];
62+
}
63+
return data;
5064
}
5165

52-
- (NSData *)readAll {
53-
return [self read:0 size:(long)_fileSize];
66+
- (NSData *)readAllWithError:(NSError **)error {
67+
return [self read:0 size:(long)_fileSize error:error];
5468
}
5569

5670
- (void)close {

QiniuSDK/Common/QNFile.m

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ @interface QNFile ()
2121

2222
@property (nonatomic) NSFileHandle *file;
2323

24+
@property (nonatomic) NSLock *lock;
25+
2426
@end
2527

2628
@implementation QNFile
@@ -67,22 +69,36 @@ - (instancetype)init:(NSString *)path
6769
}
6870
_file = f;
6971
_data = d;
72+
_lock = [[NSLock alloc] init];
7073
}
7174

7275
return self;
7376
}
7477

7578
- (NSData *)read:(long)offset
76-
size:(long)size {
77-
if (_data != nil) {
78-
return [_data subdataWithRange:NSMakeRange(offset, (unsigned int)size)];
79+
size:(long)size
80+
error:(NSError **)error {
81+
82+
NSData *data = nil;
83+
@try {
84+
[_lock lock];
85+
if (_data != nil) {
86+
data = [_data subdataWithRange:NSMakeRange(offset, (unsigned int)size)];
87+
} else {
88+
[_file seekToFileOffset:offset];
89+
data = [_file readDataOfLength:size];
90+
}
91+
} @catch (NSException *exception) {
92+
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:kQNFileError userInfo:@{NSLocalizedDescriptionKey : exception.reason}];
93+
NSLog(@"read file failed reason: %@ \n%@", exception.reason, exception.callStackSymbols);
94+
} @finally {
95+
[_lock unlock];
7996
}
80-
[_file seekToFileOffset:offset];
81-
return [_file readDataOfLength:size];
97+
return data;
8298
}
8399

84-
- (NSData *)readAll {
85-
return [self read:0 size:(long)_fileSize];
100+
- (NSData *)readAllWithError:(NSError **)error {
101+
return [self read:0 size:(long)_fileSize error:error];
86102
}
87103

88104
- (void)close {

QiniuSDK/Common/QNFileDelegate.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,21 @@
1818
*
1919
* @param offset 偏移地址
2020
* @param size 大小
21+
* @param error 错误信息
2122
*
2223
* @return 数据
2324
*/
2425
- (NSData *)read:(long)offset
25-
size:(long)size;
26+
size:(long)size
27+
error:(NSError **)error;
2628

2729
/**
2830
* 读取所有文件内容
2931
*
3032
* @return 数据
33+
* @error 错误信息
3134
*/
32-
- (NSData *)readAll;
35+
- (NSData *)readAllWithError:(NSError **)error;
3336

3437
/**
3538
* 关闭文件

0 commit comments

Comments
 (0)