Latest | 0.0.2 |
---|---|
Homepage | https://github.com/duanruiying/DryAWSS3 |
License | MIT |
Platforms | ios 10.0, requires ARC |
Dependencies | AWSS3 |
Frameworks | UIKit, Foundation |
Authors |
iOS: 亚马逊AWSS3简化集成(文件上传)
官网
Github
Prerequisites
- Xcode 10.2.1
- iOS 10.0 or later
- ObjC、Swift
Installation
- pod ‘DryAWSS3’
- 请到官网注册并下载对应的 "awsconfiguration.json" 文件并导入工程中
Features
上传文件
NSMutableArray<NSData *> *datas = [[NSMutableArray alloc] init];
UIImage *img1 = [UIImage imageNamed:@"1"];
NSData *data1 = UIImagePNGRepresentation(img1);
UIImage *img2 = [UIImage imageNamed:@"2"];
NSData *data2 = UIImagePNGRepresentation(img2);
[datas addObject:data1];
[datas addObject:data2];
NSMutableArray<NSString *> *keys = [[NSMutableArray alloc] init];
[keys addObject:[NSUUID UUID].UUIDString];
[keys addObject:[NSUUID UUID].UUIDString];
NSLog(@"-------------------------------");
NSLog(@"原始key集合: %@", keys);
NSString *bucket = @"";
NSString *folder = @"";
NSString *contentType = @"";
[DryAWSS3 uploadFilesWithDatas:datas keys:keys bucket:bucket folder:folder contentType:contentType progressHandler:^(NSString * _Nonnull currentKey, int64_t currentCount, int64_t currentCompleted, int64_t totalCount, int64_t totalCompleted) {
NSLog(@"-------------------------------");
NSLog(@"当前任务key: %@", currentKey);
NSLog(@"当前任务总大小: %lld", currentCount);
NSLog(@"当前任务已完成大小: %lld", currentCompleted);
NSLog(@"所有任务总大小: %lld", totalCount);
NSLog(@"所有任务已完成大小: %lld", totalCompleted);
} completionHandler:^(BOOL success, NSArray<NSString *> * _Nullable successKeys, NSArray<NSString *> * _Nullable failKeys, NSArray<NSString *> * _Nullable totalKeys) {
NSLog(@"-------------------------------");
NSLog(@"是否成功: %d", success);
NSLog(@"成功的keys: %@", successKeys);
NSLog(@"失败的keys: %@", failKeys);
NSLog(@"所有的keys: %@", totalKeys);
}];
Latest podspec
{ "name": "DryAWSS3", "version": "0.0.2", "summary": "DryAWSS3", "homepage": "https://github.com/duanruiying/DryAWSS3", "license": { "type": "MIT", "file": "LICENSE" }, "authors": { "duanruiying": "[email protected]" }, "source": { "git": "https://github.com/duanruiying/DryAWSS3.git", "tag": "0.0.2" }, "description": "TODO: u4e9au9a6cu900aAWSS3u7b80u5316u96c6u6210(u6587u4ef6u4e0au4f20).", "platforms": { "ios": "10.0" }, "requires_arc": true, "user_target_xcconfig": { "OTHER_LDFLAGS": [ "-w", "-ObjC" ] }, "pod_target_xcconfig": { "OTHER_LDFLAGS": [ "-w" ] }, "source_files": "DryAWSS3/Classes/Code/**/*", "public_header_files": "DryAWSS3/Classes/Code/Public/**/*.h", "frameworks": [ "UIKit", "Foundation" ], "dependencies": { "AWSS3": [] } }
Tue, 04 Jun 2019 10:17:18 +0000