Latest 0.0.1
Homepage https://github.com/duanruiying/DryAliyunOSS
License MIT
Platforms ios 9.0, requires ARC
Dependencies AliyunOSSiOS
Frameworks UIKit, Foundation, SystemConfiguration, CoreTelephony, CFNetwork
Authors

iOS: 简化阿里云OSS

官网:

Prerequisites

  • Xcode 10.2.1
  • iOS 9.0 or later
  • ObjC、Swift 5 or later

Installation

  • pod ‘DryAliyunOSS’

Featuress

初始化客户端

DryAliyunOSS.initClient(withEndPoint: "", delegate: delegate, config: nil)

从服务端动态获取阿里云OSSToken相关数据

实现DryAliyunOSSDelegate代理方法:
public func aliyunOSSToken(_ resp: @escaping (_ tAccessKey: String?, _ tSecretKey: String?, _ tToken: String?, _ expirationTimeInGMTFormat: String?) -> Void) {

}

图片上传

  1. 单图上传
    
    DryAliyunOSS.uploadImage(withBucket: "", imageMode: .png, image: image, objectKey: "", respProgress: { (objectKey, bytesSent, totalBytesSent, totalBytesExpectedToSend) in

}, respError: { (errorCode) in

}) { (objectKey) in

}

2. 多图片上传示例:

/// GCD Group
let group: DispatchGroup = DispatchGroup()

/// 回调队列(串行队列)
let completionQueue: DispatchQueue = DispatchQueue.main

/// 任务队列(并发队列)
let taskQueue: DispatchQueue = DispatchQueue.global()

/// 成功标记
var isSuccess: Bool = true

/// 启动队列任务
group.enter()

———–>此处代码多次执行<———–
DryAliyunOSS.uploadImage(withBucket: "", imageMode: .png, image: image, objectKey: "", taskQueue: taskQueue, completionQueue: completionQueue, respProgress: { (objectKey, bytesSent, totalBytesSent, totalBytesExpectedToSend) in

}, respError: { (errorCode) in
isSuccess = false
group.leave()
}) { (objectKey) in
group.leave()
}
———–>此处代码多次执行<———–

/// 队列组任务结束
group.notify(queue: completionQueue) {

if isSuccess {

}else {

}

}


### 图片下载
1. 单图下载

DryAliyunOSS.downloadImage(withBucket: "", objectKey: "", isCustomSize: false, imageWidth: nil, imageHeight: nil, respProgress: { (bytesWritten, totalBytesWritten, totalBytesExpectedToWrite) in

}, respError: { (errorCode) in

}) { (image) in

}

2. 多图下载传示例

/// GCD Group
let group: DispatchGroup = DispatchGroup()

/// 回调队列(串行队列)
let completionQueue: DispatchQueue = DispatchQueue.main

/// 任务队列(并发队列)
let taskQueue: DispatchQueue = DispatchQueue.global()

/// 成功标志
var isSuccess: Bool = true

/// 启动队列任务
group.enter()

———–>此处代码多次执行<———–
DryAliyunOSS.downloadImage(withBucket: "", objectKey: "", isCustomSize: false, imageWidth: nil, imageHeight: nil, taskQueue: taskQueue, completionQueue: completionQueue, respProgress: { (bytesWritten, totalBytesWritten, totalBytesExpectedToWrite) in

}, respError: { (errorCode) in
isSuccess = false
group.leave()
}) { (image) in
group.leave()
}
———–>此处代码多次执行<———–

/// 队列任务结束
group.notify(queue: completionQueue) {

if isSuccess {

}else {

}

}

Latest podspec

{
    "name": "DryAliyunOSS",
    "version": "0.0.1",
    "summary": "DryAliyunOSS",
    "homepage": "https://github.com/duanruiying/DryAliyunOSS",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "duanruiying": "[email protected]"
    },
    "source": {
        "git": "https://github.com/duanruiying/DryAliyunOSS.git",
        "tag": "0.0.1"
    },
    "description": "TODO: iOSu963fu91ccu4e91OSS.",
    "swift_version": "5",
    "platforms": {
        "ios": "9.0"
    },
    "requires_arc": true,
    "user_target_xcconfig": {
        "OTHER_LDFLAGS": [
            "-w"
        ]
    },
    "pod_target_xcconfig": {
        "OTHER_LDFLAGS": [
            "-w",
            "-ObjC"
        ]
    },
    "source_files": "DryAliyunOSS/Classes/Code/**/*",
    "libraries": "resolv",
    "frameworks": [
        "UIKit",
        "Foundation",
        "SystemConfiguration",
        "CoreTelephony",
        "CFNetwork"
    ],
    "dependencies": {
        "AliyunOSSiOS": [
            "~> 2.10.7"
        ]
    }
}

Pin It on Pinterest

Share This