Skip to content

Commit

Permalink
Update CHANGELOG.md & README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
huhuanming committed Aug 24, 2017
1 parent 4edd251 commit b0d1e3c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 65 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@

### Bugfixes

## 3.0.0 Release notes (2017-08-24)

### API breaking changes

* 将 files 从 NSMutableArray 改为 NSArray
* 将 Block 设置移到了 startUpload 函数上
* 移除了直接在 QiniuUploader 上设置 Token
* 添加了并发上传的支持

## 2.0.3 Release notes (2017-07-24)

=============================================================
Expand Down
86 changes: 21 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,17 @@ qiniu_upload 是一款支持七牛云存储的 iOS/macOS sdk。

qiniu_upload 除了文件上传等基本功能完,还实现了多文件队列上传。

## TODO
qiniu_upload 转入了维护,想去写个 UploadKit。

## Done

- [ ] 添加自动化测试
- [ ] 支持断点续传
- [x] 减小内存占用,清除内存泄露
- [x] 支持多种数据来源,包括 ALAsset, NSData,NSFileManager
- [x] 支持 NSInputStream 方式上传
- [ ] 支持分片上传
- [ ] 支持并发上传
- [x] 支持并发上传
- [x] 支持版本更新在开发环境中提示
- [x] Remove all warnings
- [x] Remove AFNetWorking support
- [ ] support More upload backends,such as s3, upyun, etc.
- [ ] support swift
- [ ] support Android

## 如何开始

Expand Down Expand Up @@ -63,12 +59,6 @@ qiniu_upload 除了文件上传等基本功能完,还实现了多文件队列

不推荐在生产环境的代码中直接填写 accesskey 和 secretKey 来使用。

#### 使用上传凭证

当然,如果你希望从自家服务器动态获取 upload_token,你也可以在获取后,填写到下面

[uploader startUploadWithAccessToken:@"your_upload_token"];

#### QiniuFile

初始化要上传的七牛文件,图片,音频都可以。
Expand All @@ -94,74 +84,40 @@ qiniu_upload 除了文件上传等基本功能完,还实现了多文件队列
#### QiniuUploader
```Objective-C
QiniuUploader 移除了对 Delegate 的支持,全部改为了 Block
```

#### add file 添加文件

```Objective-C
[uploader addFile:qiniu_file];
```
#### add files 添加文件们
```Objective-C
[uploader addFile:qiniu_file];
[uploader addFile:qiniu_file];
[uploader addFile:qiniu_file];
```

当然,你也可以这样写, the_qiniu_files 是一个 NSArray
#### 添加文件
```Objective-C
[uploader addFiles:the_qiniu_files];
uploader.files = @[file, file, file];
```

这里的 QinniuFile 可以部分是图片,部分是视频、音频,不会对上传有任何影响。

#### 上传一个文件成功时
```Objective-C
[uploader setUploadOneFileSucceeded:^(NSInteger index, NSString *key, NSDictionary *info){
NSLog(@"index:%ld key:%@ response: %@",(index, key, info);
}];
```

这个 key 就是文件在七牛的唯一标识,七牛的 CDN 地址 + key 就可以访问该文件了

#### 上传一个文件失败时

```Objective-C
[uploader setUploadOneFileFailed:^(NSInteger index, NSDictionary *error){
NSLog(@"%@",error);
}];
```
#### 当前上传文件的进度
### 设置并发上限

```Objective-C
[uploader setUploadOneFileProgress:^(NSInteger index, NSProgress *process){
NSLog(@"index:%ld process:%@", index, process);
}];
[[QiniuUploader sharedUploader] setMaxConcurrentNumber:3];
```
#### 全部上传完成

```Objective-C
[uploader setUploadAllFilesComplete:^(void){
NSLog(@"complete");
}];
```
建议不要设置过大,因为 iOS 的连接数是有限的。
#### 开始上传
上面乱七八糟的设置完了后,就调用这个开始上传
上面乱七八糟的设置完了后,就调用这个开始上传
```Objective-C
[uploader startUpload];
[uploader startUpload:uploadToken uploadOneFileSucceededHandler:^(NSInteger index, NSDictionary * _Nonnull info) {
NSLog(@"index: %ld info: %@",(long)index, info);
} uploadOneFileFailedHandler:^(NSInteger index, NSError * _Nullable error) {
NSLog(@"error: %@", error);
} uploadOneFileProgressHandler:^(NSInteger index, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend) {
NSLog(@"index:%ld percent:%f",(long)index, totalBytesSent * 1.0 / totalBytesExpectedToSend);
} uploadAllFilesComplete:^{
NSLog(@"complete");
}];
```

再次提醒,不要在 App 内直接写入 key。

#### 取消全部上传任务

当你希望取消掉所有上传任务时
Expand Down

0 comments on commit b0d1e3c

Please sign in to comment.