Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#Changelog
## 8.9.1 (2025-08-20)
- 修复回调问题

## 8.9.0 (2025-06-12)
- 分片上传默认使用 V2 接口

Expand Down
2 changes: 1 addition & 1 deletion Qiniu.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Qiniu'
s.version = '8.9.0'
s.version = '8.9.1'
s.summary = 'Qiniu Resource Storage SDK for iOS and Mac'
s.homepage = 'https://github.com/qiniu/objc-sdk'
s.social_media_url = 'http://weibo.com/qiniutek'
Expand Down
10 changes: 9 additions & 1 deletion QiniuSDK/Storage/QNFormUpload.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,20 @@

@interface QNFormUpload ()

@property(nonatomic, strong)NSLock *locker;
@property(nonatomic, strong)QNUpProgress *progress;

@property(nonatomic, strong)QNRequestTransaction *uploadTransaction;

@end

@implementation QNFormUpload

- (void)initData {
[super initData];

_locker = [[NSLock alloc] init];
}

- (void)startToUpload {
[super startToUpload];

Expand Down Expand Up @@ -61,9 +67,11 @@ - (void)startToUpload {
}

- (QNUpProgress *)progress {
[self.locker lock];
if (_progress == nil) {
_progress = [QNUpProgress progress:self.option.progressHandler byteProgress:self.option.byteProgressHandler];
}
[self.locker unlock];
return _progress;
}

Expand Down
11 changes: 8 additions & 3 deletions QiniuSDK/Storage/QNPartsUploadPerformer.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ - (instancetype)initWithSource:(id<QNUploadSource>)uploadSource
_config = config;
_recorder = config.recorder;
_recorderKey = recorderKey;

_progressLocker = [[NSLock alloc] init];
[self initData];
}
return self;
Expand Down Expand Up @@ -100,10 +100,15 @@ - (void)notifyProgress:(BOOL)isCompleted {
return;
}

QNUpProgress *progress = self.progress;
if (progress == nil) {
return;
}

if (isCompleted) {
[self.progress notifyDone:self.key totalBytes:[self.uploadInfo getSourceSize]];
[progress notifyDone:self.key totalBytes:[self.uploadInfo getSourceSize]];
} else {
[self.progress progress:self.key uploadBytes:[self.uploadInfo uploadSize] totalBytes:[self.uploadInfo getSourceSize]];
[progress progress:self.key uploadBytes:[self.uploadInfo uploadSize] totalBytes:[self.uploadInfo getSourceSize]];
}
}

Expand Down
5 changes: 5 additions & 0 deletions QiniuSDK/Storage/QNUpProgress.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#import "QNAsyncRun.h"
#import "QNDefine.h"
#import "QNUpProgress.h"

@interface QNUpProgress()
Expand Down Expand Up @@ -66,7 +67,9 @@ - (void)notify:(NSString *)key uploadBytes:(long long)uploadBytes totalBytes:(lo
}

if (self.byteProgress) {
kQNWeakSelf;
QNAsyncRunInMain(^{
kQNStrongSelf;
self.byteProgress(key, uploadBytes, totalBytes);
});
return;
Expand All @@ -77,7 +80,9 @@ - (void)notify:(NSString *)key uploadBytes:(long long)uploadBytes totalBytes:(lo
}

if (self.progress) {
kQNWeakSelf;
QNAsyncRunInMain(^{
kQNStrongSelf;
double notifyPercent = (double) uploadBytes / (double) totalBytes;
self.progress(key, notifyPercent);
});
Expand Down
2 changes: 1 addition & 1 deletion QiniuSDK/Utils/QNVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
/**
* sdk 版本
*/
static NSString *const kQiniuVersion = @"8.9.0";
static NSString *const kQiniuVersion = @"8.9.1";
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
通过 CocoaPods

```ruby
pod "Qiniu", "~> 8.8.1"
pod "Qiniu", "~> 8.9.1"
```

通过 Swift Package Manager (Xcode 11+)
Expand All @@ -26,7 +26,7 @@ File -> Swift Packages -> Add Package Dependency,输入库链接,选择相
库对接:
let package = Package(
dependencies: [
.package(url: "https://github.com/qiniu/objc-sdk", from: "8.9.0")
.package(url: "https://github.com/qiniu/objc-sdk", from: "8.9.1")
],
// ...
)
Expand Down
Loading