diff --git a/Example/ios/AliyunOSSiOS.framework/AliyunOSSiOS b/Example/ios/AliyunOSSiOS.framework/AliyunOSSiOS new file mode 100644 index 0000000..fc6d12a Binary files /dev/null and b/Example/ios/AliyunOSSiOS.framework/AliyunOSSiOS differ diff --git a/Example/ios/AliyunOSSiOS.framework/Headers/AliyunOSSiOS.h b/Example/ios/AliyunOSSiOS.framework/Headers/AliyunOSSiOS.h new file mode 100644 index 0000000..197186d --- /dev/null +++ b/Example/ios/AliyunOSSiOS.framework/Headers/AliyunOSSiOS.h @@ -0,0 +1,20 @@ +// +// AliyunOSSiOS.h +// AliyunOSSiOS +// +// Created by xuyecan on 28/11/2016. +// Copyright © 2016 xuyecan. All rights reserved. +// + +#import + +//! Project version number for AliyunOSSiOS. +FOUNDATION_EXPORT double AliyunOSSiOSVersionNumber; + +//! Project version string for AliyunOSSiOS. +FOUNDATION_EXPORT const unsigned char AliyunOSSiOSVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + +#import "OSSService.h" +#import "OSSCompat.h" diff --git a/Example/ios/AliyunOSSiOS.framework/Headers/OSSBolts.h b/Example/ios/AliyunOSSiOS.framework/Headers/OSSBolts.h new file mode 100644 index 0000000..d8b0abe --- /dev/null +++ b/Example/ios/AliyunOSSiOS.framework/Headers/OSSBolts.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import "OSSCancellationToken.h" +#import "OSSCancellationTokenRegistration.h" +#import "OSSCancellationTokenSource.h" +#import "OSSExecutor.h" +#import "OSSTask.h" +#import "OSSTaskCompletionSource.h" + + +NS_ASSUME_NONNULL_BEGIN + +/** + A string containing the version of the Bolts Framework used by the current application. + */ +extern NSString *const OSSBoltsFrameworkVersionString; + +NS_ASSUME_NONNULL_END diff --git a/Example/ios/AliyunOSSiOS.framework/Headers/OSSCancellationToken.h b/Example/ios/AliyunOSSiOS.framework/Headers/OSSCancellationToken.h new file mode 100644 index 0000000..fb2590c --- /dev/null +++ b/Example/ios/AliyunOSSiOS.framework/Headers/OSSCancellationToken.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import + +#import "OSSCancellationTokenRegistration.h" + +NS_ASSUME_NONNULL_BEGIN + +/*! + A block that will be called when a token is cancelled. + */ +typedef void(^OSSCancellationBlock)(); + +/*! + The consumer view of a CancellationToken. + Propagates notification that operations should be canceled. + A OSSCancellationToken has methods to inspect whether the token has been cancelled. + */ +@interface OSSCancellationToken : NSObject + +/*! + Whether cancellation has been requested for this token source. + */ +@property (nonatomic, assign, readonly, getter=isCancellationRequested) BOOL cancellationRequested; + +/*! + Register a block to be notified when the token is cancelled. + If the token is already cancelled the delegate will be notified immediately. + */ +- (OSSCancellationTokenRegistration *)registerCancellationObserverWithBlock:(OSSCancellationBlock)block; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Example/ios/AliyunOSSiOS.framework/Headers/OSSCancellationTokenRegistration.h b/Example/ios/AliyunOSSiOS.framework/Headers/OSSCancellationTokenRegistration.h new file mode 100644 index 0000000..6649a7f --- /dev/null +++ b/Example/ios/AliyunOSSiOS.framework/Headers/OSSCancellationTokenRegistration.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/*! + Represents the registration of a cancellation observer with a cancellation token. + Can be used to unregister the observer at a later time. + */ +@interface OSSCancellationTokenRegistration : NSObject + +/*! + Removes the cancellation observer registered with the token + and releases all resources associated with this registration. + */ +- (void)dispose; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Example/ios/AliyunOSSiOS.framework/Headers/OSSCancellationTokenSource.h b/Example/ios/AliyunOSSiOS.framework/Headers/OSSCancellationTokenSource.h new file mode 100644 index 0000000..acb2d08 --- /dev/null +++ b/Example/ios/AliyunOSSiOS.framework/Headers/OSSCancellationTokenSource.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class OSSCancellationToken; + +/*! + OSSCancellationTokenSource represents the producer side of a CancellationToken. + Signals to a CancellationToken that it should be canceled. + It is a cancellation token that also has methods + for changing the state of a token by cancelling it. + */ +@interface OSSCancellationTokenSource : NSObject + +/*! + Creates a new cancellation token source. + */ ++ (instancetype)cancellationTokenSource; + +/*! + The cancellation token associated with this CancellationTokenSource. + */ +@property (nonatomic, strong, readonly) OSSCancellationToken *token; + +/*! + Whether cancellation has been requested for this token source. + */ +@property (nonatomic, assign, readonly, getter=isCancellationRequested) BOOL cancellationRequested; + +/*! + Cancels the token if it has not already been cancelled. + */ +- (void)cancel; + +/*! + Schedules a cancel operation on this CancellationTokenSource after the specified number of milliseconds. + @param millis The number of milliseconds to wait before completing the returned task. + If delay is `0` the cancel is executed immediately. If delay is `-1` any scheduled cancellation is stopped. + */ +- (void)cancelAfterDelay:(int)millis; + +/*! + Releases all resources associated with this token source, + including disposing of all registrations. + */ +- (void)dispose; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Example/ios/AliyunOSSiOS.framework/Headers/OSSClient.h b/Example/ios/AliyunOSSiOS.framework/Headers/OSSClient.h new file mode 100644 index 0000000..ecc166c --- /dev/null +++ b/Example/ios/AliyunOSSiOS.framework/Headers/OSSClient.h @@ -0,0 +1,273 @@ +// +// OSSClient.h +// oss_ios_sdk +// +// Created by zhouzhuo on 8/16/15. +// Copyright (c) 2015 aliyun.com. All rights reserved. +// + +#import +@class OSSGetServiceRequest; +@class OSSCreateBucketRequest; +@class OSSDeleteBucketRequest; +@class OSSHeadObjectRequest; +@class OSSGetBucketRequest; +@class OSSGetBucketACLRequest; +@class OSSGetObjectRequest; +@class OSSPutObjectRequest; +@class OSSPutObjectACLRequest; +@class OSSDeleteObjectRequest; +@class OSSCopyObjectRequest; +@class OSSInitMultipartUploadRequest; +@class OSSUploadPartRequest; +@class OSSCompleteMultipartUploadRequest; +@class OSSListPartsRequest; +@class OSSAbortMultipartUploadRequest; +@class OSSAppendObjectRequest; +@class OSSResumableUploadRequest; +@class OSSTask; +@class OSSExecutor; + +@class OSSNetworking; +@class OSSClientConfiguration; +@protocol OSSCredentialProvider; + +NS_ASSUME_NONNULL_BEGIN + +/** + OSSClient是OSS服务的iOS客户端,它为调用者提供了一系列的方法,用于和OSS服务进行交互。 + 一般来说,全局内只需要保持一个OSSClient,用来调用各种操作。 + */ +@interface OSSClient : NSObject + +/** + OSS访问域名 + */ +@property (nonatomic, strong) NSString * endpoint; + +/** + 用以收发网络请求 + */ +@property (nonatomic, strong) OSSNetworking * networking; + +/** + 提供访问所需凭证 + */ +@property (nonatomic, strong) id credentialProvider; + +/** + 客户端设置 + */ +@property (nonatomic, strong) OSSClientConfiguration * clientConfiguration; + +/** + 任务队列 + */ +@property (nonatomic, strong, readonly) OSSExecutor * ossOperationExecutor; + +/** + 初始化OSSClient,使用默认的本地设置 + @endpoint 指明Bucket所在的Region域名,2017年以后苹果要求APP符合ATS政策,这里要写https的endpoint,如 "https://oss-cn-hangzhou.aliyuncs.com" + @credentialProvider 需要实现的签名器 + */ +- (instancetype)initWithEndpoint:(NSString *)endpoint + credentialProvider:(id) credentialProvider; + +/** + 初始化OSSClient,使用自定义设置 + @endpoint 指明Bucket所在的Region域名,2017年以后苹果要求APP符合ATS政策,这里要写https的endpoint,如 "https://oss-cn-hangzhou.aliyuncs.com" + @credentialProvider 需要实现的签名器 + @conf 可以设置一些本地参数如重试次数、超时时间等 + */ +- (instancetype)initWithEndpoint:(NSString *)endpoint + credentialProvider:(id)credentialProvider + clientConfiguration:(OSSClientConfiguration *)conf; + +#pragma mark restful-api + +/** + 对应RESTFul API:GetService + 获取请求者当前拥有的全部Bucket。 + 注意: + 1. 尚不支持STS; + 2. 当所有的bucket都返回时,返回的xml中不包含Prefix、Marker、MaxKeys、IsTruncated、NextMarker节点,如果还有部分结果未返回,则增加上述节点,其中NextMarker用于继续查询时给marker赋值。 + */ +- (OSSTask *)getService:(OSSGetServiceRequest *)request; + +/** + 对应RESTFul API:PutBucket + 用于创建Bucket(不支持匿名访问)。默认情况下,创建的Bucket位于默认的数据中心:oss-cn-hangzhou。 + 用户可以显式指定Bucket位于的数据中心,从而最优化延迟,最小化费用或者满足监管要求等。 + 注意: + 1. 尚不支持STS。 + */ +- (OSSTask *)createBucket:(OSSCreateBucketRequest *)request; + +/** + 对应RESTFul API:DeleteBucket + 用于删除某个Bucket。 + */ +- (OSSTask *)deleteBucket:(OSSDeleteBucketRequest *)request; + +/** + 对应RESTFul API:GetBucket + 用来list Bucket中所有Object的信息,可以通过prefix,marker,delimiter和max-keys对list做限定,返回部分结果。 + */ +- (OSSTask *)getBucket:(OSSGetBucketRequest *)request; + +/** + 对应RESTFul API:GetBucketACL + 用来获取某个Bucket的访问权限。 + */ +- (OSSTask *)getBucketACL:(OSSGetBucketACLRequest *)request; + +/** + 对应RESTFul API:HeadObject + 只返回某个Object的meta信息,不返回文件内容。 + */ +- (OSSTask *)headObject:(OSSHeadObjectRequest *)request; + +/** + 对应RESTFul API:GetObject + 用于获取某个Object,此操作要求用户对该Object有读权限。 + */ +- (OSSTask *)getObject:(OSSGetObjectRequest *)request; + +/** + 对应RESTFul API:PutObject + 用于上传文件。 + */ +- (OSSTask *)putObject:(OSSPutObjectRequest *)request; + +/** + Put Object ACL接口用于修改Object的访问权限。目前Object有三种访问权限:private, public-read, public-read-write。 + Put Object ACL操作通过Put请求中的“x-oss-object-acl”头来设置,这个操作只有Bucket Owner有权限执行。如果操作成功,则返回200;否则返回相应的错误码和提示信息。 + */ +- (OSSTask *)putObjectACL:(OSSPutObjectACLRequest *)request; + +/** + 对应RESTFul API:AppendObject + 以追加写的方式上传文件。通过Append Object操作创建的Object类型为Appendable Object,而通过Put Object上传的Object是Normal Object。 + */ +- (OSSTask *)appendObject:(OSSAppendObjectRequest *)request; + +/** + 对应RESTFul API:copyObject + 拷贝一个在OSS上已经存在的object成另外一个object,可以发送一个PUT请求给OSS,并在PUT请求头中添加元素“x-oss-copy-source”来指定拷贝源。 + OSS会自动判断出这是一个Copy操作,并直接在服务器端执行该操作。如果拷贝成功,则返回新的object信息给用户。 + 该操作适用于拷贝小于1GB的文件。 + */ +- (OSSTask *)copyObject:(OSSCopyObjectRequest *)request; + +/** + 对应RESTFul API:DeleteObject + 用于删除某个Object。 + */ +- (OSSTask *)deleteObject:(OSSDeleteObjectRequest *)request; + +/** + 对应RESTFul API:InitiateMultipartUpload + 使用Multipart Upload模式传输数据前,必须先调用该接口来通知OSS初始化一个Multipart Upload事件。该接口会返回一个OSS服务器创建的全局唯一的Upload ID,用于标识本次Multipart Upload事件。 + 用户可以根据这个ID来发起相关的操作,如中止Multipart Upload、查询Multipart Upload等。 + */ +- (OSSTask *)multipartUploadInit:(OSSInitMultipartUploadRequest *)request; + +/** + 对应RESTFul API:UploadPart + 初始化一个Multipart Upload之后,可以根据指定的Object名和Upload ID来分块(Part)上传数据。 + 每一个上传的Part都有一个标识它的号码(part number,范围是1~10,000)。 + 对于同一个Upload ID,该号码不但唯一标识这一块数据,也标识了这块数据在整个文件内的相对位置。 + 如果你用同一个part号码,上传了新的数据,那么OSS上已有的这个号码的Part数据将被覆盖。除了最后一块Part以外,其他的part最小为100KB; + 最后一块Part没有大小限制。 + */ +- (OSSTask *)uploadPart:(OSSUploadPartRequest *)request; + +/** + 对应RESTFul API:CompleteMultipartUpload + 在将所有数据Part都上传完成后,必须调用Complete Multipart Upload API来完成整个文件的Multipart Upload。 + 在执行该操作时,用户必须提供所有有效的数据Part的列表(包括part号码和ETAG);OSS收到用户提交的Part列表后,会逐一验证每个数据Part的有效性。 + 当所有的数据Part验证通过后,OSS将把这些数据part组合成一个完整的Object。 + */ +- (OSSTask *)completeMultipartUpload:(OSSCompleteMultipartUploadRequest *)request; + +/** + 对应RESTFul API:ListParts + 可以罗列出指定Upload ID所属的所有已经上传成功Part。 + */ +- (OSSTask *)listParts:(OSSListPartsRequest *)request; + +/** + 对应RESTFul API:AbortMultipartUpload + 该接口可以根据用户提供的Upload ID中止其对应的Multipart Upload事件。 + 当一个Multipart Upload事件被中止后,就不能再使用这个Upload ID做任何操作,已经上传的Part数据也会被删除。 + */ +- (OSSTask *)abortMultipartUpload:(OSSAbortMultipartUploadRequest *)request; + +#pragma mark extention method + +/** + 对一个Object签名出一个URL,可以把该URL转给第三方实现授权访问。 + @bucketName Object所在的Bucket名称 + @objectKey Object名称 + @interval 签名URL时,可以指定这个URL的有效时长是多久,单位是秒,比如说需要有效时长为1小时的URL,这里传入3600 + */ +- (OSSTask *)presignConstrainURLWithBucketName:(NSString *)bucketName + withObjectKey:(NSString *)objectKey + withExpirationInterval:(NSTimeInterval)interval; + +/** + 对一个Object签名出一个URL,可以把该URL转给第三方实现授权访问。 + @bucketName Object所在的Bucket名称 + @objectKey Object名称 + @interval 签名URL时,可以指定这个URL的有效时长是多久,单位是秒,比如说需要有效时长为1小时的URL,这里传入3600 + @parameter 参数 + */ +- (OSSTask *)presignConstrainURLWithBucketName:(NSString *)bucketName + withObjectKey:(NSString *)objectKey + withExpirationInterval:(NSTimeInterval)interval + withParameters:(NSDictionary *)parameters; + +/** + 如果Object的权限是公共读或者公共读写,调用这个接口对该Object签名出一个URL,可以把该URL转给第三方实现授权访问。 + @bucketName Object所在的Bucket名称 + @objectKey Object名称 + */ +- (OSSTask *)presignPublicURLWithBucketName:(NSString *)bucketName + withObjectKey:(NSString *)objectKey; + +/** + 如果Object的权限是公共读或者公共读写,调用这个接口对该Object签名出一个URL,可以把该URL转给第三方实现授权访问。 + @bucketName Object所在的Bucket名称 + @objectKey Object名称 + @parameter 参数 + */ +- (OSSTask *)presignPublicURLWithBucketName:(NSString *)bucketName + withObjectKey:(NSString *)objectKey + withParameters:(NSDictionary *)parameters; + +/** + 断点上传接口 + 这个接口封装了分块上传的若干接口以实现断点上传,但是需要用户自行保存UploadId。 + 对一个新文件,用户需要首先调用multipartUploadInit接口获得一个UploadId,然后调用此接口上传这个文件。 + 如果上传失败,首先需要检查一下失败原因: + 如果非不可恢复的失败,那么可以用同一个UploadId和同一文件继续调用这个接口续传 + 否则,需要重新获取UploadId,重新上传这个文件。 + 详细参考demo。 + */ +- (OSSTask *)resumableUpload:(OSSResumableUploadRequest *)request; + +/** + 查看某个Object是否存在 + @bucketName Object所在的Bucket名称 + @objectKey Object名称 + + return YES Object存在 + return NO && *error = nil Object不存在 + return NO && *error != nil 发生错误 + */ +- (BOOL)doesObjectExistInBucket:(NSString *)bucketName + objectKey:(NSString *)objectKey + error:(const NSError **)error; +@end + +NS_ASSUME_NONNULL_END diff --git a/Example/ios/AliyunOSSiOS.framework/Headers/OSSCompat.h b/Example/ios/AliyunOSSiOS.framework/Headers/OSSCompat.h new file mode 100644 index 0000000..fb6dc78 --- /dev/null +++ b/Example/ios/AliyunOSSiOS.framework/Headers/OSSCompat.h @@ -0,0 +1,81 @@ +// +// OSSCompat.h +// oss_ios_sdk_new +// +// Created by zhouzhuo on 9/10/15. +// Copyright (c) 2015 aliyun.com. All rights reserved. +// + +#import +#import "OSSService.h" + +@class OSSCancellationTokenSource; + +typedef OSSCancellationTokenSource OSSTaskHandler; + +@interface OSSClient (Compat) + +/** + 兼容老版本用法的上传数据接口 + 建议更换使用:putObject + */ +- (OSSTaskHandler *)uploadData:(NSData *)data + withContentType:(NSString *)contentType + withObjectMeta:(NSDictionary *)meta + toBucketName:(NSString *)bucketName + toObjectKey:(NSString *)objectKey + onCompleted:(void(^)(BOOL, NSError *))onCompleted + onProgress:(void(^)(float progress))onProgress; + +/** + 兼容老版本用法的下载数据接口 + 建议更换使用:getObject + */ +- (OSSTaskHandler *)downloadToDataFromBucket:(NSString *)bucketName + objectKey:(NSString *)objectKey + onCompleted:(void(^)(NSData *, NSError *))onCompleted + onProgress:(void(^)(float progress))onProgress; + +/** + 兼容老版本用法的上传文件接口 + 建议更换使用:putObject + */ +- (OSSTaskHandler *)uploadFile:(NSString *)filePath + withContentType:(NSString *)contentType + withObjectMeta:(NSDictionary *)meta + toBucketName:(NSString *)bucketName + toObjectKey:(NSString *)objectKey + onCompleted:(void(^)(BOOL, NSError *))onCompleted + onProgress:(void(^)(float progress))onProgress; + +/** + 兼容老版本用法的下载文件接口 + 建议更换使用:getObject + */ +- (OSSTaskHandler *)downloadToFileFromBucket:(NSString *)bucketName + objectKey:(NSString *)objectKey + toFile:(NSString *)filePath + onCompleted:(void(^)(BOOL, NSError *))onCompleted + onProgress:(void(^)(float progress))onProgress; + + +/** + 兼容老版本用法的断点上传文件接口 + 建议更换使用:resumableUpload + */ +- (OSSTaskHandler *)resumableUploadFile:(NSString *)filePath + withContentType:(NSString *)contentType + withObjectMeta:(NSDictionary *)meta + toBucketName:(NSString *)bucketName + toObjectKey:(NSString *)objectKey + onCompleted:(void(^)(BOOL, NSError *))onCompleted + onProgress:(void(^)(float progress))onProgress; + +/** + 兼容老版本用法的删除Object接口 + 建议更换使用:deleteObject + */ +- (void)deleteObjectInBucket:(NSString *)bucketName + objectKey:(NSString *)objectKey + onCompleted:(void(^)(BOOL, NSError *))onCompleted; +@end \ No newline at end of file diff --git a/Example/ios/AliyunOSSiOS.framework/Headers/OSSDefine.h b/Example/ios/AliyunOSSiOS.framework/Headers/OSSDefine.h new file mode 100644 index 0000000..45c04d2 --- /dev/null +++ b/Example/ios/AliyunOSSiOS.framework/Headers/OSSDefine.h @@ -0,0 +1,67 @@ +// +// OSSDefine.h +// AliyunOSSiOS +// +// Created by zhouzhuo on 5/1/16. +// Copyright © 2016 zhouzhuo. All rights reserved. +// + +#import + +#ifndef OSSDefine_h +#define OSSDefine_h + +#define OSSUAPrefix @"aliyun-sdk-ios" +#define OSSSDKVersion @"2.6.1" + +#define OSSListBucketResultXMLTOKEN @"ListBucketResult" +#define OSSNameXMLTOKEN @"Name" +#define OSSDelimiterXMLTOKEN @"Delimiter" +#define OSSMarkerXMLTOKEN @"Marker" +#define OSSNextMarkerXMLTOKEN @"NextMarker" +#define OSSMaxKeysXMLTOKEN @"MaxKeys" +#define OSSIsTruncatedXMLTOKEN @"IsTruncated" +#define OSSContentsXMLTOKEN @"Contents" +#define OSSKeyXMLTOKEN @"Key" +#define OSSLastModifiedXMLTOKEN @"LastModified" +#define OSSETagXMLTOKEN @"ETag" +#define OSSTypeXMLTOKEN @"Type" +#define OSSSizeXMLTOKEN @"Size" +#define OSSStorageClassXMLTOKEN @"StorageClass" +#define OSSCommonPrefixesXMLTOKEN @"CommonPrefixes" +#define OSSOwnerXMLTOKEN @"Owner" +#define OSSAccessControlListXMLTOKEN @"AccessControlList" +#define OSSGrantXMLTOKEN @"Grant" +#define OSSIDXMLTOKEN @"ID" +#define OSSDisplayNameXMLTOKEN @"DisplayName" +#define OSSBucketsXMLTOKEN @"Buckets" +#define OSSBucketXMLTOKEN @"Bucket" +#define OSSCreationDate @"CreationDate" +#define OSSPrefixXMLTOKEN @"Prefix" +#define OSSUploadIdXMLTOKEN @"UploadId" +#define OSSLocationXMLTOKEN @"Location" +#define OSSNextPartNumberMarkerXMLTOKEN @"NextPartNumberMarker" +#define OSSMaxPartsXMLTOKEN @"MaxParts" +#define OSSPartXMLTOKEN @"Part" +#define OSSPartNumberXMLTOKEN @"PartNumber" + +#define OSSClientErrorDomain @"com.aliyun.oss.clientError" +#define OSSServerErrorDomain @"com.aliyun.oss.serverError" + +#define OSSErrorMessageTOKEN @"ErrorMessage" + +#define OSSHttpHeaderContentDisposition @"Content-Disposition" +#define OSSHttpHeaderXOSSCallback @"x-oss-callback" +#define OSSHttpHeaderXOSSCallbackVar @"x-oss-callback-var" +#define OSSHttpHeaderContentEncoding @"Content-Encoding" +#define OSSHttpHeaderContentType @"Content-Type" +#define OSSHttpHeaderContentMD5 @"Content-MD5" +#define OSSHttpHeaderCacheControl @"Cache-Control" +#define OSSHttpHeaderExpires @"Expires" + +#define OSSDefaultRetryCount 3 +#define OSSDefaultMaxConcurrentNum 5 +#define OSSDefaultTimeoutForRequestInSecond 15 +#define OSSDefaultTimeoutForResourceInSecond 7 * 24 * 60 * 60 + +#endif /* OSSDefine_h */ diff --git a/Example/ios/AliyunOSSiOS.framework/Headers/OSSExecutor.h b/Example/ios/AliyunOSSiOS.framework/Headers/OSSExecutor.h new file mode 100644 index 0000000..b2f5b65 --- /dev/null +++ b/Example/ios/AliyunOSSiOS.framework/Headers/OSSExecutor.h @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/*! + An object that can run a given block. + */ +@interface OSSExecutor : NSObject + +/*! + Returns a default executor, which runs continuations immediately until the call stack gets too + deep, then dispatches to a new GCD queue. + */ ++ (instancetype)defaultExecutor; + +/*! + Returns an executor that runs continuations on the thread where the previous task was completed. + */ ++ (instancetype)immediateExecutor; + +/*! + Returns an executor that runs continuations on the main thread. + */ ++ (instancetype)mainThreadExecutor; + +/*! + Returns a new executor that uses the given block to execute continuations. + @param block The block to use. + */ ++ (instancetype)executorWithBlock:(void(^)(void(^block)()))block; + +/*! + Returns a new executor that runs continuations on the given queue. + @param queue The instance of `dispatch_queue_t` to dispatch all continuations onto. + */ ++ (instancetype)executorWithDispatchQueue:(dispatch_queue_t)queue; + +/*! + Returns a new executor that runs continuations on the given queue. + @param queue The instance of `NSOperationQueue` to run all continuations on. + */ ++ (instancetype)executorWithOperationQueue:(NSOperationQueue *)queue; + +/*! + Runs the given block using this executor's particular strategy. + @param block The block to execute. + */ +- (void)execute:(void(^)())block; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Example/ios/AliyunOSSiOS.framework/Headers/OSSLog.h b/Example/ios/AliyunOSSiOS.framework/Headers/OSSLog.h new file mode 100644 index 0000000..2a40ca8 --- /dev/null +++ b/Example/ios/AliyunOSSiOS.framework/Headers/OSSLog.h @@ -0,0 +1,40 @@ +// +// OSSLog.h +// oss_ios_sdk +// +// Created by zhouzhuo on 8/16/15. +// Copyright (c) 2015 aliyun.com. All rights reserved. +// + +#import + +// colorful log configuration +// see https://github.com/robbiehanson/XcodeColors + +#define XCODE_COLORS_ESCAPE @"\033[" + +#define XCODE_COLORS_RESET_FG XCODE_COLORS_ESCAPE @"fg;" // Clear any foreground color +#define XCODE_COLORS_RESET_BG XCODE_COLORS_ESCAPE @"bg;" // Clear any background color +#define XCODE_COLORS_RESET XCODE_COLORS_ESCAPE @";" // Clear any foreground or background color + +#define OSSLogVerbose(frmt, ...)\ +if ([OSSLog isLogEnable]) {\ +NSLog(@"[Verbose]: %@", [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\ +} + +#define OSSLogDebug(frmt, ...)\ +if ([OSSLog isLogEnable]) {\ +NSLog(@"[Debug]: %@", [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\ +} + +#define OSSLogError(frmt, ...)\ +if ([OSSLog isLogEnable]) {\ +NSLog(@"[Error]: %@", [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\ +} +static BOOL isEnable; + +@interface OSSLog : NSObject ++ (void)enableLog; ++ (void)disableLog; ++ (BOOL)isLogEnable; +@end diff --git a/Example/ios/AliyunOSSiOS.framework/Headers/OSSModel.h b/Example/ios/AliyunOSSiOS.framework/Headers/OSSModel.h new file mode 100644 index 0000000..9478301 --- /dev/null +++ b/Example/ios/AliyunOSSiOS.framework/Headers/OSSModel.h @@ -0,0 +1,1303 @@ +// +// OSSModel.h +// oss_ios_sdk +// +// Created by zhouzhuo on 8/16/15. +// Copyright (c) 2015 aliyun.com. All rights reserved. +// + +#import + +@class OSSAllRequestNeededMessage; +@class OSSFederationToken; +@class OSSTask; + +typedef NS_ENUM(NSInteger, OSSOperationType) { + OSSOperationTypeGetService, + OSSOperationTypeCreateBucket, + OSSOperationTypeDeleteBucket, + OSSOperationTypeGetBucket, + OSSOperationTypeGetBucketACL, + OSSOperationTypeHeadObject, + OSSOperationTypeGetObject, + OSSOperationTypePutObject, + OSSOperationTypePutObjectACL, + OSSOperationTypeAppendObject, + OSSOperationTypeDeleteObject, + OSSOperationTypeCopyObject, + OSSOperationTypeInitMultipartUpload, + OSSOperationTypeUploadPart, + OSSOperationTypeCompleteMultipartUpload, + OSSOperationTypeAbortMultipartUpload, + OSSOperationTypeListMultipart +}; + +typedef NS_ENUM(NSInteger, OSSClientErrorCODE) { + OSSClientErrorCodeNetworkingFailWithResponseCode0, + OSSClientErrorCodeSignFailed, + OSSClientErrorCodeFileCantWrite, + OSSClientErrorCodeInvalidArgument, + OSSClientErrorCodeNilUploadid, + OSSClientErrorCodeTaskCancelled, + OSSClientErrorCodeNetworkError, + OSSClientErrorCodeCannotResumeUpload, + OSSClientErrorCodeExcpetionCatched, + OSSClientErrorCodeNotKnown +}; + +typedef void (^OSSNetworkingUploadProgressBlock) (int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend); +typedef void (^OSSNetworkingDownloadProgressBlock) (int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite); +typedef void (^OSSNetworkingCompletionHandlerBlock) (id responseObject, NSError *error); +typedef void (^OSSNetworkingOnRecieveDataBlock) (NSData * data); + +typedef NSString * (^OSSCustomSignContentBlock) (NSString * contentToSign, NSError **error); +typedef OSSFederationToken * (^OSSGetFederationTokenBlock) (); + +/** + 扩展NSString + */ +@interface NSString (OSS) +- (NSString *)oss_stringByAppendingPathComponentForURL:(NSString *)aString; +- (NSString *)oss_trim; +@end + +/** + 扩展NSDictionary + */ +@interface NSDictionary (OSS) +- (NSString *)base64JsonString; +@end + +/** + 扩展NSDate + */ +@interface NSDate (OSS) ++ (void)oss_setStandardTimeIntervalSince1970:(NSTimeInterval)standardTime; ++ (void)oss_setClockSkew:(NSTimeInterval)clockSkew; ++ (NSDate *)oss_dateFromString:(NSString *)string; ++ (NSDate *)oss_clockSkewFixedDate; +- (NSString *)oss_asStringValue; +@end + +/** + 线程安全的字典 + */ +@interface OSSSyncMutableDictionary : NSObject +@property (nonatomic, strong) NSMutableDictionary *dictionary; +@property (nonatomic, strong) dispatch_queue_t dispatchQueue; + +- (id)objectForKey:(id)aKey; +- (NSArray *)allKeys; +- (void)setObject:(id)anObject forKey:(id )aKey; +- (void)removeObjectForKey:(id)aKey; +@end + +/** + FederationToken类 + */ +@interface OSSFederationToken : NSObject +@property (nonatomic, strong) NSString * tAccessKey; +@property (nonatomic, strong) NSString * tSecretKey; +@property (nonatomic, strong) NSString * tToken; + +/** + 指明Token的失效时间,为linux时间对应的毫秒数,即自UTC时间1970年1月1日经过的毫秒数 + */ +@property (atomic, assign) int64_t expirationTimeInMilliSecond; + +/** + 指明Token的失效时间,格式为GMT字符串,如: "2015-11-03T08:51:05Z" + */ +@property (atomic, strong) NSString * expirationTimeInGMTFormat; +@end + +/** + CredentialProvider协议,要求实现加签接口 + */ +@protocol OSSCredentialProvider +@optional +- (NSString *)sign:(NSString *)content error:(NSError **)error; +@end + +/** + 用明文AK/SK实现的加签器,建议只在测试模式时使用 + */ + +@interface OSSPlainTextAKSKPairCredentialProvider : NSObject +@property (nonatomic, strong) NSString * accessKey; +@property (nonatomic, strong) NSString * secretKey; + +- (instancetype)initWithPlainTextAccessKey:(NSString *)accessKey + secretKey:(NSString *)secretKey __attribute__((deprecated("We recommend the STS authentication mode on mobile"))); +@end + +/** + 用户自实现加签接口的加签器 + */ +@interface OSSCustomSignerCredentialProvider : NSObject +@property (nonatomic, copy) NSString * (^signContent)(NSString *, NSError **); + +/** + 任务执行时,这个方法会被调用,进行加签 + 会在任务执行的后台线程被调用,而非UI线程 + */ +- (instancetype)initWithImplementedSigner:(OSSCustomSignContentBlock)signContent; +@end + +/** + 用户自实现的通过获取FederationToken来加签的加签器 + */ +@interface OSSFederationCredentialProvider : NSObject +@property (nonatomic, strong) OSSFederationToken * cachedToken; +@property (nonatomic, copy) OSSFederationToken * (^federationTokenGetter)(); + +/** + 任务执行时,这个方法会被调用,获取新的ststoken + 会在任务执行的后台线程被调用,而非UI线程 + */ +- (instancetype)initWithFederationTokenGetter:(OSSGetFederationTokenBlock)federationTokenGetter; +- (OSSFederationToken *)getToken:(NSError **)error; +@end + +/** + 通过已经获取到的StsToken来加签的加签器 + */ +@interface OSSStsTokenCredentialProvider : NSObject +@property (nonatomic, strong) NSString * accessKeyId; +@property (nonatomic, strong) NSString * secretKeyId; +@property (nonatomic, strong) NSString * securityToken; + +- (OSSFederationToken *)getToken; +- (instancetype)initWithAccessKeyId:(NSString *)accessKeyId + secretKeyId:(NSString *)secretKeyId + securityToken:(NSString *)securityToken; +@end + +/** + OSSClient可以设置的参数 + */ +@interface OSSClientConfiguration : NSObject + +/** + 最大重试次数 + */ +@property (nonatomic, assign) uint32_t maxRetryCount; + +/** + 最大并发请求数 + */ +@property (nonatomic, assign) uint32_t maxConcurrentRequestCount; + +/** + 是否开启后台传输服务 + 注意:只在上传文件时有效 + */ +@property (nonatomic, assign) BOOL enableBackgroundTransmitService; + +/** + 是否使用Httpdns解析域名 + */ +@property (nonatomic, assign) BOOL isHttpdnsEnable; + +/** + 设置后台传输服务使用session的Id + */ +@property (nonatomic, strong) NSString * backgroundSesseionIdentifier; + +/** + 请求超时时间 + */ +@property (nonatomic, assign) NSTimeInterval timeoutIntervalForRequest; + +/** + 单个Object下载的最长持续时间 + */ +@property (nonatomic, assign) NSTimeInterval timeoutIntervalForResource; + +/** + 设置代理Host、端口 + */ +@property (nonatomic, strong) NSString * proxyHost; +@property (nonatomic, strong) NSNumber * proxyPort; + +/** + 设置Cname排除列表 + */ +@property (nonatomic, strong, setter=setCnameExcludeList:) NSArray * cnameExcludeList; + +@end + +@protocol OSSRequestInterceptor +- (OSSTask *)interceptRequestMessage:(OSSAllRequestNeededMessage *)request; +@end + +/** + 构造请求过程中做加签 + */ +@interface OSSSignerInterceptor : NSObject +@property (nonatomic, strong) id credentialProvider; + +- (instancetype)initWithCredentialProvider:(id)credentialProvider; +@end + +/** + 构造请求过程中修改UA + */ +@interface OSSUASettingInterceptor : NSObject +@end + +/** + 构造请求过程中设置发起请求的标准时间 + */ +@interface OSSTimeSkewedFixingInterceptor : NSObject +@end + +/** + 下载时指定范围 + */ +@interface OSSRange : NSObject +@property (nonatomic, assign) int64_t startPosition; +@property (nonatomic, assign) int64_t endPosition; + +- (instancetype)initWithStart:(int64_t)start + withEnd:(int64_t)end; + +/** + * 转换为字符串: 'bytes=${start}-${end}' + */ +- (NSString *)toHeaderString; +@end + + +#pragma mark RequestAndResultClass + +/** + 请求头的基类 + */ +@interface OSSRequest : NSObject +/** + 指明该请求是否需要鉴权,单次有效 + */ +@property (nonatomic, assign) BOOL isAuthenticationRequired; + +/** + 指明该请求是否已经被取消 + */ +@property (nonatomic, assign) BOOL isCancelled; + +/** + 取消这个请求 + */ +- (void)cancel; +@end + +/** + 请求结果的基类 + */ +@interface OSSResult : NSObject + +/** + 请求HTTP响应码 + */ +@property (nonatomic, assign) NSInteger httpResponseCode; + +/** + 请求HTTP响应头部,以KV形式放在字典中 + */ +@property (nonatomic, strong) NSDictionary * httpResponseHeaderFields; + +/** + x-oss-request-id是由Aliyun OSS创建,并唯一标识这个response的UUID。如果在使用OSS服务时遇到问题,可以凭借该字段联系OSS工作人员,快速定位问题。 + */ +@property (nonatomic, strong) NSString * requestId; +@end + +/** + 罗列用户拥有的所有Bucket的请求。 + */ +@interface OSSGetServiceRequest : OSSRequest + +/** + 限定返回的bucket name必须以prefix作为前缀,可以不设定,不设定时不过滤前缀信息 + */ +@property (nonatomic, strong) NSString * prefix; + +/** + 设定结果从marker之后按字母排序的第一个开始返回,可以不设定,不设定时从头开始返回 + */ +@property (nonatomic, strong) NSString * marker; + +/** + 限定此次返回bucket的最大数,如果不设定,默认为100,max-keys取值不能大于1000 + */ +@property (nonatomic, assign) int32_t maxKeys; + + +/** + 根据参数各字段构造URL中的查询串 + */ +- (NSMutableDictionary *)getQueryDict; +@end + +/** + 罗列用户拥有的所有Bucket的请求结果 + */ +@interface OSSGetServiceResult : OSSResult + +/** + Bucket拥有者的用户ID + */ +@property (nonatomic, strong) NSString * ownerId; + +/** + Bucket拥有者的名称 (目前和ID一致)。 + */ +@property (nonatomic, strong) NSString * ownerDispName; + +/** + 本次查询结果的前缀,当bucket未全部返回时才有此节点 + */ +@property (nonatomic, strong) NSString * prefix; + +/** + 标明这次GetService(ListBucket)的起点,当bucket未全部返回时才有此节点 + */ +@property (nonatomic, strong) NSString * marker; + +/** + 响应请求内返回结果的最大数目,当bucket未全部返回时才有此节点 + */ +@property (nonatomic, assign) int32_t maxKeys; + +/** + 指明是否所有的结果都已经返回:“true”表示本次没有返回全部结果;“false”表示本次已经返回了全部结果。当bucket未全部返回时才有此节点。 + */ +@property (nonatomic, assign) BOOL isTruncated; + +/** + 表示下一次GetService(ListBucket)可以以此为marker,将未返回的结果返回。当bucket未全部返回时才有此节点。 + */ +@property (nonatomic, strong) NSString * nextMarker; + +/** + 保存bucket信息的容器,结构上是一个数组,数组每个元素是一个字典,字典的key有 ["Name", "CreationDate", "Location" ] + */ +@property (nonatomic, strong) NSArray * buckets; +@end + +/** + 创建Bucket的请求 + */ +@interface OSSCreateBucketRequest : OSSRequest + +/** + 要创建的Bucket的名称 + */ +@property (nonatomic, strong) NSString * bucketName; + +/** + 指定Bucket所在的数据中心。 + 关于数据中心和终端域名的更多内容,参见访问域名和数据中心https://docs.aliyun.com/#/pub/oss/product-documentation/domain-region + */ +@property (nonatomic, strong) NSString * location; + +/** + 设置Bucket 访问权限。目前Bucket有三种访问权限:public-read-write,public-read和private。 + */ +@property (nonatomic, strong) NSString * xOssACL; +@end + +/** + 创建Bucket的请求结果 + */ +@interface OSSCreateBucketResult : OSSResult + +/** + Bucket所在的数据中心 + */ +@property (nonatomic, strong) NSString * location; +@end + +/** + 删除Bucket的请求 + */ +@interface OSSDeleteBucketRequest : OSSRequest + +/** + Bucket的名称 + */ +@property (nonatomic, strong) NSString * bucketName; +@end + +/** + 删除Bucket的请求结果 + */ +@interface OSSDeleteBucketResult : OSSResult +@end + +/** + 罗列Bucket中Objects的请求 + */ +@interface OSSGetBucketRequest : OSSRequest + +/** + Bucket名称 + */ +@property (nonatomic, strong) NSString * bucketName; + +/** + 是一个用于对Object名字进行分组的字符。所有名字包含指定的前缀且第一次出现delimiter字符之间的object作为一组元素——CommonPrefixes。 + */ +@property (nonatomic, strong) NSString * delimiter; + +/** + 设定结果从marker之后按字母排序的第一个开始返回。 + */ +@property (nonatomic, strong) NSString * marker; + +/** + 限定此次返回object的最大数,如果不设定,默认为100,max-keys取值不能大于1000。 + */ +@property (nonatomic, assign) int32_t maxKeys; + +/** + 限定返回的object key必须以prefix作为前缀。注意使用prefix查询时,返回的key中仍会包含prefix。 + */ +@property (nonatomic, strong) NSString * prefix; + +/** + 根据请求的各个字段生成URL中的查询串 + */ +- (NSMutableDictionary *)getQueryDict; +@end + +/** + 罗列Bucket中Objects的请求结果 + */ +@interface OSSGetBucketResult : OSSResult + +/** + Bucket名称 + */ +@property (nonatomic, strong) NSString * bucketName; + +/** + 限定返回的object key必须以prefix作为前缀。注意使用prefix查询时,返回的key中仍会包含prefix。 + */ +@property (nonatomic, strong) NSString * prefix; + +/** + 设定结果从marker之后按字母排序的第一个开始返回。 + */ +@property (nonatomic, strong) NSString * marker; + +/** + 限定此次返回object的最大数,如果不设定,默认为100,max-keys取值不能大于1000。 + */ +@property (nonatomic, assign) int32_t maxKeys; + +/** + 是一个用于对Object名字进行分组的字符。所有名字包含指定的前缀且第一次出现delimiter字符之间的object作为一组元素——CommonPrefixes。 + */ +@property (nonatomic, strong) NSString * delimiter; + +/** + 如果因为max-keys的设定无法一次完成listing,返回结果会附加一个,提示继续listing可以以此为marker。 + NextMarker中的值仍在list结果之中。 + */ +@property (nonatomic, strong) NSString * nextMarker; + +/** + 指明是否所有的结果都已经返回; “true”表示本次没有返回全部结果;“false”表示本次已经返回了全部结果。 + */ +@property (nonatomic, assign) BOOL isTruncated; + +/** + 装载文件信息的容器,结构为一个数组,数组中元素是一个个字典,代表每个文件,字典的key有 [ "Key", "LastModified", "ETag", "Type", "Size", "StorageClass", "Owner" ] + */ +@property (nonatomic, strong) NSArray * contents; + +/** + 装载公共前缀信息的容器,结构为一个数组,数组中元素是NSString,每个代表一个前缀 + */ +@property (nonatomic, strong) NSArray * commentPrefixes; +@end + +/** + 获取指定Bucket的读写权限 + */ +@interface OSSGetBucketACLRequest : OSSRequest + +/** + Bucket名称 + */ +@property (nonatomic, strong) NSString * bucketName; +@end + +/** + 获取指定Bucket的ACL的请求结果 + */ +@interface OSSGetBucketACLResult : OSSResult + +/** + 获取到的Bucket的ACL,有 private/public-read/public-read-write + */ +@property (nonatomic, strong) NSString * aclGranted; +@end + +/** + 获取Object Meta信息的请求 + */ +@interface OSSHeadObjectRequest : OSSRequest + +/** + Object所在Bucket的名称 + */ +@property (nonatomic, strong) NSString * bucketName; + +/** + Object名称 + */ +@property (nonatomic, strong) NSString * objectKey; +@end + +/** + 获取Object Meta信息的结果 + */ +@interface OSSHeadObjectResult : OSSResult + +/** + Obejct的Meta信息 + */ +@property (nonatomic, strong) NSDictionary * objectMeta; +@end + +/** + 下载Object的请求头 + */ +@interface OSSGetObjectRequest : OSSRequest + +/** + Bucket名称 + */ +@property (nonatomic, strong) NSString * bucketName; + +/** + Object名称 + */ +@property (nonatomic, strong) NSString * objectKey; + +/** + 指定文件传输的范围。如,设定 bytes=0-9,表示传送第0到第9这10个字符。 + */ +@property (nonatomic, strong) OSSRange * range; + +/** + 如果希望Object直接下载到文件中,通过这个字段指明文件地址 + */ +@property (nonatomic, strong) NSURL * downloadToFileURL; + +/** + 图片处理配置 + */ +@property (nonatomic, strong) NSString * xOssProcess; + +/** + 回调下载进度 + 会在任务执行的后台线程被回调,而非UI线程 + */ +@property (nonatomic, copy) OSSNetworkingDownloadProgressBlock downloadProgress; + +/** + Object下载过程中,会在接收每一段数据后回调这个Block + 会在任务执行的后台线程被回调,而非UI线程 + */ +@property (nonatomic, copy) OSSNetworkingOnRecieveDataBlock onRecieveData; +@end + +/** + 下载Object的请求结果 + */ +@interface OSSGetObjectResult : OSSResult + +/** + 如果下载时未指明下载到文件,那么Object会被下载到内存中,类型为NSData + */ +@property (nonatomic, strong) NSData * downloadedData; + +/** + 下载文件时的HTTP响应头的KV字典 + */ +@property (nonatomic, strong) NSDictionary * objectMeta; +@end + +/** + 修改Object的访问权限请求头 + */ +@interface OSSPutObjectACLRequest : OSSRequest + +/** + Bucket名称 + */ +@property (nonatomic, strong) NSString * bucketName; + +/** + Object名称 + */ +@property (nonatomic, strong) NSString * objectKey; + +/** + */ +@property (nonatomic, strong) NSString * acl; + +@end + +/** + 修改Object的访问权限响应 + */ +@interface OSSPutObjectACLResult : OSSResult +@end + +/** + 上传Object的请求头 + */ +@interface OSSPutObjectRequest : OSSRequest + +/** + Bucket名称 + */ +@property (nonatomic, strong) NSString * bucketName; + +/** + Object名称 + */ +@property (nonatomic, strong) NSString * objectKey; + +/** + 从内存中的NSData上传时,通过这个字段设置 + */ +@property (nonatomic, strong) NSData * uploadingData; + +/** + 从文件上传时,通过这个字段设置 + */ +@property (nonatomic, strong) NSURL * uploadingFileURL; + +/** + server回调参数设置 + */ +@property (nonatomic, strong) NSDictionary * callbackParam; + +/** + server回调变量设置 + */ +@property (nonatomic, strong) NSDictionary * callbackVar; + +/** + 设置文件类型 + */ +@property (nonatomic, strong) NSString * contentType; + +/** + 根据协议RFC 1864对消息内容(不包括头部)计算MD5值获得128比特位数字,对该数字进行base64编码为一个消息的Content-MD5值。 + 该请求头可用于消息合法性的检查(消息内容是否与发送时一致)。虽然该请求头是可选项,OSS建议用户使用该请求头进行端到端检查。 + */ +@property (nonatomic, strong) NSString * contentMd5; + +/** + 指定该Object被下载时的名称;更详细描述请参照RFC2616。 + */ +@property (nonatomic, strong) NSString * contentDisposition; + +/** + 指定该Object被下载时的内容编码格式;更详细描述请参照RFC2616。 + */ +@property (nonatomic, strong) NSString * contentEncoding; + +/** + 指定该Object被下载时的网页的缓存行为;更详细描述请参照RFC2616。 + */ +@property (nonatomic, strong) NSString * cacheControl; + +/** + 过期时间(milliseconds);更详细描述请参照RFC2616。 + */ +@property (nonatomic, strong) NSString * expires; + +/** + 可以在这个字段中携带以x-oss-meta-为前缀的参数,则视为user meta,比如x-oss-meta-location。一个Object可以有多个类似的参数,但所有的user meta总大小不能超过8k。 + 如果上传时还需要指定其他HTTP请求头字段,也可以在这里设置 + */ +@property (nonatomic, strong) NSDictionary * objectMeta; + +/** + 上传进度回调, + 会在任务执行的后台线程被回调,而非UI线程 + */ +@property (nonatomic, copy) OSSNetworkingUploadProgressBlock uploadProgress; +@end + +/** + 上传Object的请求结果 + */ +@interface OSSPutObjectResult : OSSResult + +/** + ETag (entity tag) 在每个Object生成的时候被创建,用于标示一个Object的内容。 + 对于Put Object请求创建的Object,ETag值是其内容的MD5值;对于其他方式创建的Object,ETag值是其内容的UUID。 + ETag值可以用于检查Object内容是否发生变化。 + */ +@property (nonatomic, strong) NSString * eTag; + +/** + 如果设置了server回调,回调的响应内容 + */ +@property (nonatomic, strong) NSString * serverReturnJsonString; +@end + +/** + * append object request + */ +@interface OSSAppendObjectRequest : OSSRequest + +/** + Bucket名称 + */ +@property (nonatomic, strong) NSString * bucketName; + +/** + Object名称 + */ +@property (nonatomic, strong) NSString * objectKey; + +/** + 指定从何处进行追加。首次追加操作的position必须为0,后续追加操作的position是Object的当前长度。 + 例如,第一次Append Object请求指定position值为0,content-length是65536;那么,第二次Append Object需要指定position为65536。 + 每次操作成功后,响应头部x-oss-next-append-position也会标明下一次追加的position。 + */ +@property (nonatomic, assign) int64_t appendPosition; + +/** + 从内存中的NSData上传时,通过这个字段设置 + */ +@property (nonatomic, strong) NSData * uploadingData; + +/** + 从文件上传时,通过这个字段设置 + */ +@property (nonatomic, strong) NSURL * uploadingFileURL; + +/** + 设置文件类型 + */ +@property (nonatomic, strong) NSString * contentType; + +/** + 根据协议RFC 1864对消息内容(不包括头部)计算MD5值获得128比特位数字,对该数字进行base64编码为一个消息的Content-MD5值。 + 该请求头可用于消息合法性的检查(消息内容是否与发送时一致)。虽然该请求头是可选项,OSS建议用户使用该请求头进行端到端检查。 + */ +@property (nonatomic, strong) NSString * contentMd5; + +/** + 指定该Object被下载时的名称;更详细描述请参照RFC2616。 + */ +@property (nonatomic, strong) NSString * contentDisposition; + +/** + 指定该Object被下载时的内容编码格式;更详细描述请参照RFC2616。 + */ +@property (nonatomic, strong) NSString * contentEncoding; + +/** + 指定该Object被下载时的网页的缓存行为;更详细描述请参照RFC2616。 + */ +@property (nonatomic, strong) NSString * cacheControl; + +/** + 过期时间(milliseconds);更详细描述请参照RFC2616。 + */ +@property (nonatomic, strong) NSString * expires; + +/** + 可以在这个字段中携带以x-oss-meta-为前缀的参数,则视为user meta,比如x-oss-meta-location。一个Object可以有多个类似的参数,但所有的user meta总大小不能超过8k。 + 如果上传时还需要指定其他HTTP请求头字段,也可以在这里设置 + */ +@property (nonatomic, strong) NSDictionary * objectMeta; + +/** + 上传进度回调 + 会在任务执行的后台线程被回调,而非UI线程 + */ +@property (nonatomic, copy) OSSNetworkingUploadProgressBlock uploadProgress; +@end + +/** + * append object result + */ +@interface OSSAppendObjectResult : OSSResult + +/** + ETag (entity tag) 在每个Object生成的时候被创建,用于标示一个Object的内容。 + 对于Put Object请求创建的Object,ETag值是其内容的MD5值;对于其他方式创建的Object,ETag值是其内容的UUID。 + ETag值可以用于检查Object内容是否发生变化。 + */ +@property (nonatomic, strong) NSString * eTag; + +/** + 指明下一次请求应当提供的position。实际上就是当前Object长度。 + 当Append Object成功返回,或是因position和Object长度不匹配而引起的409错误时,会包含此header。 + */ +@property (nonatomic, assign, readwrite) int64_t xOssNextAppendPosition; +@end + +/** + 删除指定Object + */ +@interface OSSDeleteObjectRequest : OSSRequest + +/** + Bucket名称 + */ +@property (nonatomic, strong) NSString * bucketName; + +/** + Object名称 + */ +@property (nonatomic, strong) NSString * objectKey; +@end + +/** + 删除指定Object的响应 + */ +@interface OSSDeleteObjectResult : OSSResult +@end + +/** + 复制一个Object的请求 + */ +@interface OSSCopyObjectRequest : OSSRequest + +/** + Bucket名称 + */ +@property (nonatomic, strong) NSString * bucketName; + +/** + Object名称 + */ +@property (nonatomic, strong) NSString * objectKey; + +/** + 复制源地址(必须有可读权限) + */ +@property (nonatomic, strong) NSString * sourceCopyFrom; + +/** + 设置文件类型 + */ +@property (nonatomic, strong) NSString * contentType; + +/** + 根据协议RFC 1864对消息内容(不包括头部)计算MD5值获得128比特位数字,对该数字进行base64编码为一个消息的Content-MD5值。 + 该请求头可用于消息合法性的检查(消息内容是否与发送时一致)。虽然该请求头是可选项,OSS建议用户使用该请求头进行端到端检查。 + */ +@property (nonatomic, strong) NSString * contentMd5; + +/** + 可以在这个字段中携带以x-oss-meta-为前缀的参数,则视为user meta,比如x-oss-meta-location。一个Object可以有多个类似的参数,但所有的user meta总大小不能超过8k。 + 如果上传时还需要指定其他HTTP请求头字段,也可以在这里设置 + */ +@property (nonatomic, strong) NSDictionary * objectMeta; +@end + +/** + 复制Object的请求结果 + */ +@interface OSSCopyObjectResult : OSSResult + +/** + 新Object最后更新时间。 + */ +@property (nonatomic, strong) NSString * lastModifed; + +/** + 新Object的ETag值。 + */ +@property (nonatomic, strong) NSString * eTag; +@end + +/** + 初始化分块上传的请求 + */ +@interface OSSInitMultipartUploadRequest : OSSRequest + +/** + Bucket名称 + */ +@property (nonatomic, strong) NSString * bucketName; + +/** + Object名称 + */ +@property (nonatomic, strong) NSString * objectKey; + +/** + 设置文件类型 + */ +@property (nonatomic, strong) NSString * contentType; + +/** + 指定该Object被下载时的名称;更详细描述请参照RFC2616。 + */ +@property (nonatomic, strong) NSString * contentDisposition; + +/** + 指定该Object被下载时的内容编码格式;更详细描述请参照RFC2616。 + */ +@property (nonatomic, strong) NSString * contentEncoding; + +/** + 指定该Object被下载时的网页的缓存行为;更详细描述请参照RFC2616。 + */ +@property (nonatomic, strong) NSString * cacheControl; + +/** + 过期时间(milliseconds);更详细描述请参照RFC2616。 + */ +@property (nonatomic, strong) NSString * expires; + +/** + 可以在这个字段中携带以x-oss-meta-为前缀的参数,则视为user meta,比如x-oss-meta-location。一个Object可以有多个类似的参数,但所有的user meta总大小不能超过8k。 + 如果上传时还需要指定其他HTTP请求头字段,也可以在这里设置 + */ +@property (nonatomic, strong) NSDictionary * objectMeta; +@end + +/** + 初始化分块上传的请求结果 + */ +@interface OSSInitMultipartUploadResult : OSSResult + +/** + 唯一标示此次Multipart Upload事件的ID。 + */ +@property (nonatomic, strong) NSString * uploadId; +@end + +/** + 上传单个分块的请求 + */ +@interface OSSUploadPartRequest : OSSRequest + +/** + Bucket名称 + */ +@property (nonatomic, strong) NSString * bucketName; + +/** + Object名称 + */ +@property (nonatomic, strong) NSString * objectkey; + +/** + 唯一标示此次Multipart Upload事件的ID。 + */ +@property (nonatomic, strong) NSString * uploadId; + +/** + 指定本次上传分块的标识号码 + */ +@property (nonatomic, assign) int partNumber; + +/** + 根据协议RFC 1864对消息内容(不包括头部)计算MD5值获得128比特位数字,对该数字进行base64编码为一个消息的Content-MD5值。 + 该请求头可用于消息合法性的检查(消息内容是否与发送时一致)。虽然该请求头是可选项,OSS建议用户使用该请求头进行端到端检查。 + */ +@property (nonatomic, strong) NSString * contentMd5; + +/** + 从内存中的NSData上传时,通过这个字段设置 + */ +@property (nonatomic, strong) NSData * uploadPartData; + +/** + 从文件上传时,通过这个字段设置 + */ +@property (nonatomic, strong) NSURL * uploadPartFileURL; + +/** + 上传进度回调 + 会在任务执行的后台线程被回调,而非UI线程 + */ +@property (nonatomic, copy) OSSNetworkingUploadProgressBlock uploadPartProgress; +@end + +/** + 上传单个分块的结果 + */ +@interface OSSUploadPartResult : OSSResult +@property (nonatomic, strong) NSString * eTag; +@end + +/** + 分块上传中每个分块的信息,这些信息将会在调用‘完成分块上传’的接口中使用 + */ +@interface OSSPartInfo : NSObject + +/** + 指定本次上传分块的标识号码 + */ +@property (nonatomic, assign) int32_t partNum; + +/** + Part成功上传后,OSS返回的ETag值。 + */ +@property (nonatomic, strong) NSString * eTag; + +/** + 分块数据长度 + */ +@property (nonatomic, assign) int64_t size; + ++ (instancetype)partInfoWithPartNum:(int32_t)partNum + eTag:(NSString *)eTag + size:(int64_t)size; +@end + +/** + 完成分块上传请求 + */ +@interface OSSCompleteMultipartUploadRequest : OSSRequest + +/** + Bucket名称 + */ +@property (nonatomic, strong) NSString * bucketName; + +/** + Object名称 + */ +@property (nonatomic, strong) NSString * objectKey; + +/** + 唯一标示此次Multipart Upload事件的ID。 + */ +@property (nonatomic, strong) NSString * uploadId; + +/** + 根据协议RFC 1864对消息内容(不包括头部)计算MD5值获得128比特位数字,对该数字进行base64编码为一个消息的Content-MD5值。 + 该请求头可用于消息合法性的检查(消息内容是否与发送时一致)。虽然该请求头是可选项,OSS建议用户使用该请求头进行端到端检查。 + */ +@property (nonatomic, strong) NSString * contentMd5; + +/** + 各个分块的信息 + */ +@property (nonatomic, strong) NSArray * partInfos; + +/** + server回调参数设置 + */ +@property (nonatomic, strong) NSDictionary * callbackParam; + +/** + server回调变量设置 + */ +@property (nonatomic, strong) NSDictionary * callbackVar; + +/** + 完成分块上传附带的请求头 + */ +@property (nonatomic, strong) NSDictionary * completeMetaHeader; +@end + +/** + 完成分块上传请求的结果 + */ +@interface OSSCompleteMultipartUploadResult : OSSResult + +/** + 新创建Object的URL。 + */ +@property (nonatomic, strong) NSString * location; + +/** + ETag (entity tag) 在每个Object生成的时候被创建,用于标示一个Object的内容。 + Complete Multipart Upload请求创建的Object,ETag值是其内容的UUID。ETag值可以用于检查Object内容是否发生变化。. + */ +@property (nonatomic, strong) NSString * eTag; + +/** + 如果设置了server回调,回调的响应内容 + */ +@property (nonatomic, strong) NSString * serverReturnJsonString; +@end + +/** + 罗列某次分块上传事件已经上传的分块请求 + */ +@interface OSSListPartsRequest : OSSRequest + +/** + Bucket名称 + */ +@property (nonatomic, strong) NSString * bucketName; + +/** + Object名称 + */ +@property (nonatomic, strong) NSString * objectKey; + +/** + 唯一标示此次Multipart Upload事件的ID。 + */ +@property (nonatomic, strong) NSString * uploadId; + +/** + 返回请求中最大的Part数目。 + */ +@property (nonatomic, assign) int maxParts; + +/** + 指定List的起始位置,只有Part Number数目大于该参数的Part会被列出。 + */ +@property (nonatomic, assign) int partNumberMarker; +@end + +/** + 罗列分块请求的结果 + */ +@interface OSSListPartsResult : OSSResult + +/** + 如果本次没有返回全部结果,响应请求中将包含NextPartNumberMarker元素,用于标明接下来请求的PartNumberMarker值。 + */ +@property (nonatomic, assign) int nextPartNumberMarker; + +/** + 返回请求中最大的Part数目。 + */ +@property (nonatomic, assign) int maxParts; + +/** + 标明是否本次返回的List Part结果列表被截断。“true”表示本次没有返回全部结果;“false”表示本次已经返回了全部结果。 + */ +@property (nonatomic, assign) BOOL isTruncated; + +/** + 保存Part信息的容器。 + */ +@property (nonatomic, strong) NSArray * parts; +@end + +/** + 取消分块上传事件请求 + */ +@interface OSSAbortMultipartUploadRequest : OSSRequest + +/** + Bucket名称 + */ +@property (nonatomic, strong) NSString * bucketName; + +/** + Object名称 + */ +@property (nonatomic, strong) NSString * objectKey; + +/** + 唯一标示此次Multipart Upload事件的ID。 + */ +@property (nonatomic, strong) NSString * uploadId; +@end + +/** + 取消分块上传事件的结果 + */ +@interface OSSAbortMultipartUploadResult : OSSResult +@end + +/** + 断点续传请求 + */ +@interface OSSResumableUploadRequest : OSSRequest + +/** + 一个续传事件对应着同一个唯一的UploadId + */ +@property (nonatomic, strong) NSString * uploadId; + +/** + Bucket名称 + */ +@property (nonatomic, strong) NSString * bucketName; + +/** + Object名称 + */ +@property (nonatomic, strong) NSString * objectKey; + +/** + 从文件上传时,通过这个字段设置 + */ +@property (nonatomic, strong) NSURL * uploadingFileURL; + +/** + 自定义分块大小,最小100KB + */ +@property (nonatomic, assign) int64_t partSize; + +/** + 上传进度 + 会在任务执行的后台线程被回调,而非UI线程 + */ +@property (nonatomic, copy) OSSNetworkingUploadProgressBlock uploadProgress; + +/** + server回调参数设置 + */ +@property (nonatomic, strong) NSDictionary * callbackParam; + +/** + server回调变量设置 + */ +@property (nonatomic, strong) NSDictionary * callbackVar; + +/** + 完成分块上传附带的请求头 + */ +@property (nonatomic, strong) NSDictionary * completeMetaHeader; + +/** + 当前正在处理的子请求 + */ +@property (atomic, weak) OSSRequest * runningChildrenRequest; + +- (void)cancel; +@end + +/** + 断点续传的结果 + */ +@interface OSSResumableUploadResult : OSSResult +/** + 如果设置了server回调,回调的响应内容 + */ +@property (nonatomic, strong) NSString * serverReturnJsonString; +@end + +#pragma mark 其他 + +/** + HTTP响应内容解析器 + */ +@interface OSSHttpResponseParser : NSObject +@property (nonatomic, strong) NSURL * downloadingFileURL; +@property (nonatomic, copy) OSSNetworkingOnRecieveDataBlock onRecieveBlock; + +- (instancetype)initForOperationType:(OSSOperationType)operationType; +- (void)consumeHttpResponse:(NSHTTPURLResponse *)response; +- (OSSTask *)consumeHttpResponseBody:(NSData *)data; +- (id)constructResultObject; +- (void)reset; +@end diff --git a/Example/ios/AliyunOSSiOS.framework/Headers/OSSNetworking.h b/Example/ios/AliyunOSSiOS.framework/Headers/OSSNetworking.h new file mode 100644 index 0000000..3c1388e --- /dev/null +++ b/Example/ios/AliyunOSSiOS.framework/Headers/OSSNetworking.h @@ -0,0 +1,143 @@ +// +// OSSNetworking.h +// oss_ios_sdk +// +// Created by zhouzhuo on 8/16/15. +// Copyright (c) 2015 aliyun.com. All rights reserved. +// + +#import +#import "OSSModel.h" + +@class OSSSyncMutableDictionary; +@class OSSNetworkingRequestDelegate; +@class OSSExecutor; + +/** + 定义重试类型 + */ +typedef NS_ENUM(NSInteger, OSSNetworkingRetryType) { + OSSNetworkingRetryTypeUnknown, + OSSNetworkingRetryTypeShouldRetry, + OSSNetworkingRetryTypeShouldNotRetry, + OSSNetworkingRetryTypeShouldRefreshCredentialsAndRetry, + OSSNetworkingRetryTypeShouldCorrectClockSkewAndRetry +}; + +/** + 重试处理器 + */ +@interface OSSURLRequestRetryHandler : NSObject +@property (nonatomic, assign) uint32_t maxRetryCount; + +- (OSSNetworkingRetryType)shouldRetry:(uint32_t)currentRetryCount + requestDelegate:(OSSNetworkingRequestDelegate *)delegate + response:(NSHTTPURLResponse *)response + error:(NSError *)error; + +- (NSTimeInterval)timeIntervalForRetry:(uint32_t)currentRetryCount + retryType:(OSSNetworkingRetryType)retryType; + ++ (instancetype)defaultRetryHandler; +@end + +/** + 网络参数设置 + */ +@interface OSSNetworkingConfiguration : NSObject +@property (nonatomic, assign) uint32_t maxRetryCount; +@property (nonatomic, assign) uint32_t maxConcurrentRequestCount; +@property (nonatomic, assign) BOOL enableBackgroundTransmitService; +@property (nonatomic, strong) NSString * backgroundSessionIdentifier; +@property (nonatomic, assign) NSTimeInterval timeoutIntervalForRequest; +@property (nonatomic, assign) NSTimeInterval timeoutIntervalForResource; +@property (nonatomic, strong) NSString * proxyHost; +@property (nonatomic, strong) NSNumber * proxyPort; +@end + +/** + 对操作发起的每一次请求构造一个信息代理 + */ +@interface OSSNetworkingRequestDelegate : NSObject + +@property (nonatomic, strong) NSMutableArray * interceptors; +@property (nonatomic, strong) OSSAllRequestNeededMessage * allNeededMessage; +@property (nonatomic, strong) NSMutableURLRequest * internalRequest; +@property (nonatomic, assign) OSSOperationType operType; +@property (nonatomic, assign) BOOL isAccessViaProxy; + +@property (nonatomic, assign) BOOL isRequestCancelled; + +@property (nonatomic, strong) OSSHttpResponseParser * responseParser; + +@property (nonatomic, strong) NSData * uploadingData; +@property (nonatomic, strong) NSURL * uploadingFileURL; + +@property (nonatomic, assign) int64_t payloadTotalBytesWritten; + +@property (nonatomic, assign) BOOL isBackgroundUploadFileTask; +@property (nonatomic, assign) BOOL isHttpdnsEnable; + +@property (nonatomic, strong) OSSURLRequestRetryHandler * retryHandler; +@property (nonatomic, assign) uint32_t currentRetryCount; +@property (nonatomic, strong) NSError * error; +@property (nonatomic, assign) BOOL isHttpRequestNotSuccessResponse; +@property (nonatomic, strong) NSMutableData * httpRequestNotSuccessResponseBody; + +@property (atomic, strong) NSURLSessionDataTask * currentSessionTask; + +@property (nonatomic, copy) OSSNetworkingUploadProgressBlock uploadProgress; +@property (nonatomic, copy) OSSNetworkingDownloadProgressBlock downloadProgress; +@property (nonatomic, copy) OSSNetworkingCompletionHandlerBlock completionHandler; +@property (nonatomic, copy) OSSNetworkingOnRecieveDataBlock onRecieveData; + +- (OSSTask *)buildInternalHttpRequest; +- (void)reset; +- (void)cancel; +@end + +/** + 包含一次网络请求所需的所有信息 + */ +@interface OSSAllRequestNeededMessage : NSObject +@property (nonatomic, strong) NSString * endpoint; +@property (nonatomic, strong) NSString * httpMethod; +@property (nonatomic, strong) NSString * bucketName; +@property (nonatomic, strong) NSString * objectKey; +@property (nonatomic, strong) NSString * contentType; +@property (nonatomic, strong) NSString * contentMd5; +@property (nonatomic, strong) NSString * range; +@property (nonatomic, strong) NSString * date; +@property (nonatomic, strong) NSMutableDictionary * headerParams; +@property (nonatomic, strong) NSMutableDictionary * querys; + +@property (nonatomic, assign) BOOL isHostInCnameExcludeList; + +- (instancetype)initWithEndpoint:(NSString *)endpoint + httpMethod:(NSString *)httpMethod + bucketName:(NSString *)bucketName + objectKey:(NSString *)objectKey + type:(NSString *)contentType + md5:(NSString *)contentMd5 + range:(NSString *)range + date:(NSString *)date + headerParams:(NSMutableDictionary *)headerParams + querys:(NSMutableDictionary *)querys; + +- (OSSTask *)validateRequestParamsInOperationType:(OSSOperationType)operType; +@end + +/** + 每个OSSClient持有一个OSSNetworking用以收发网络请求 + */ +@interface OSSNetworking : NSObject +@property (nonatomic, strong) NSURLSession * dataSession; +@property (nonatomic, strong) NSURLSession * uploadFileSession; +@property (nonatomic, assign) BOOL isUsingBackgroundSession; +@property (nonatomic, strong) OSSSyncMutableDictionary * sessionDelagateManager; +@property (nonatomic, strong) OSSNetworkingConfiguration * configuration; +@property (nonatomic, strong) OSSExecutor * taskExecutor; + +- (instancetype)initWithConfiguration:(OSSNetworkingConfiguration *)configuration; +- (OSSTask *)sendRequest:(OSSNetworkingRequestDelegate *)request; +@end diff --git a/Example/ios/AliyunOSSiOS.framework/Headers/OSSService.h b/Example/ios/AliyunOSSiOS.framework/Headers/OSSService.h new file mode 100644 index 0000000..5942bf0 --- /dev/null +++ b/Example/ios/AliyunOSSiOS.framework/Headers/OSSService.h @@ -0,0 +1,20 @@ +// +// OSSService.h +// oss_ios_sdk +// +// Created by zhouzhuo on 8/20/15. +// Copyright (c) 2015 aliyun.com. All rights reserved. +// + +#import + +#define OSS_IOS_SDK_VERSION OSSSDKVersion + +#import "OSSDefine.h" +#import "OSSNetworking.h" +#import "OSSClient.h" +#import "OSSModel.h" +#import "OSSUtil.h" +#import "OSSLog.h" + +#import "OSSBolts.h" diff --git a/Example/ios/AliyunOSSiOS.framework/Headers/OSSTask.h b/Example/ios/AliyunOSSiOS.framework/Headers/OSSTask.h new file mode 100644 index 0000000..8b15c54 --- /dev/null +++ b/Example/ios/AliyunOSSiOS.framework/Headers/OSSTask.h @@ -0,0 +1,281 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import + +#import "OSSCancellationToken.h" + +NS_ASSUME_NONNULL_BEGIN + +/*! + Error domain used if there was multiple errors on . + */ +extern NSString *const OSSTaskErrorDomain; + +/*! + An error code used for , if there were multiple errors. + */ +extern NSInteger const kOSSMultipleErrorsError; + +/*! + An exception that is thrown if there was multiple exceptions on . + */ +extern NSString *const OSSTaskMultipleExceptionsException; + +/*! + An error userInfo key used if there were multiple errors on . + Value type is `NSArray *`. + */ +extern NSString *const OSSTaskMultipleErrorsUserInfoKey; + +/*! + An error userInfo key used if there were multiple exceptions on . + Value type is `NSArray *`. + */ +extern NSString *const OSSTaskMultipleExceptionsUserInfoKey; + +@class OSSExecutor; +@class OSSTask; + +/*! + The consumer view of a Task. A OSSTask has methods to + inspect the state of the task, and to add continuations to + be run once the task is complete. + */ +@interface OSSTask<__covariant ResultType> : NSObject + +/*! + A block that can act as a continuation for a task. + */ +typedef __nullable id(^OSSContinuationBlock)(OSSTask *task); + +/*! + Creates a task that is already completed with the given result. + @param result The result for the task. + */ ++ (instancetype)taskWithResult:(nullable ResultType)result; + +/*! + Creates a task that is already completed with the given error. + @param error The error for the task. + */ ++ (instancetype)taskWithError:(NSError *)error; + +/*! + Creates a task that is already completed with the given exception. + @param exception The exception for the task. + */ ++ (instancetype)taskWithException:(NSException *)exception; + +/*! + Creates a task that is already cancelled. + */ ++ (instancetype)cancelledTask; + +/*! + Returns a task that will be completed (with result == nil) once + all of the input tasks have completed. + @param tasks An `NSArray` of the tasks to use as an input. + */ ++ (instancetype)taskForCompletionOfAllTasks:(nullable NSArray *)tasks; + +/*! + Returns a task that will be completed once all of the input tasks have completed. + If all tasks complete successfully without being faulted or cancelled the result will be + an `NSArray` of all task results in the order they were provided. + @param tasks An `NSArray` of the tasks to use as an input. + */ ++ (instancetype)taskForCompletionOfAllTasksWithResults:(nullable NSArray *)tasks; + +/*! + Returns a task that will be completed once there is at least one successful task. + The first task to successuly complete will set the result, all other tasks results are + ignored. + @param tasks An `NSArray` of the tasks to use as an input. + */ ++ (instancetype)taskForCompletionOfAnyTask:(nullable NSArray *)tasks; + +/*! + Returns a task that will be completed a certain amount of time in the future. + @param millis The approximate number of milliseconds to wait before the + task will be finished (with result == nil). + */ ++ (instancetype)taskWithDelay:(int)millis; + +/*! + Returns a task that will be completed a certain amount of time in the future. + @param millis The approximate number of milliseconds to wait before the + task will be finished (with result == nil). + @param token The cancellation token (optional). + */ ++ (instancetype)taskWithDelay:(int)millis cancellationToken:(nullable OSSCancellationToken *)token; + +/*! + Returns a task that will be completed after the given block completes with + the specified executor. + @param executor A OSSExecutor responsible for determining how the + continuation block will be run. + @param block The block to immediately schedule to run with the given executor. + @returns A task that will be completed after block has run. + If block returns a OSSTask, then the task returned from + this method will not be completed until that task is completed. + */ ++ (instancetype)taskFromExecutor:(OSSExecutor *)executor withBlock:(nullable id (^)())block; + +// Properties that will be set on the task once it is completed. + +/*! + The result of a successful task. + */ +@property (nullable, nonatomic, strong, readonly) ResultType result; + +/*! + The error of a failed task. + */ +@property (nullable, nonatomic, strong, readonly) NSError *error; + +/*! + The exception of a failed task. + */ +@property (nullable, nonatomic, strong, readonly) NSException *exception; + +/*! + Whether this task has been cancelled. + */ +@property (nonatomic, assign, readonly, getter=isCancelled) BOOL cancelled; + +/*! + Whether this task has completed due to an error or exception. + */ +@property (nonatomic, assign, readonly, getter=isFaulted) BOOL faulted; + +/*! + Whether this task has completed. + */ +@property (nonatomic, assign, readonly, getter=isCompleted) BOOL completed; + +/*! + Enqueues the given block to be run once this task is complete. + This method uses a default execution strategy. The block will be + run on the thread where the previous task completes, unless the + the stack depth is too deep, in which case it will be run on a + dispatch queue with default priority. + @param block The block to be run once this task is complete. + @returns A task that will be completed after block has run. + If block returns a OSSTask, then the task returned from + this method will not be completed until that task is completed. + */ +- (OSSTask *)continueWithBlock:(OSSContinuationBlock)block; + +/*! + Enqueues the given block to be run once this task is complete. + This method uses a default execution strategy. The block will be + run on the thread where the previous task completes, unless the + the stack depth is too deep, in which case it will be run on a + dispatch queue with default priority. + @param block The block to be run once this task is complete. + @param cancellationToken The cancellation token (optional). + @returns A task that will be completed after block has run. + If block returns a OSSTask, then the task returned from + this method will not be completed until that task is completed. + */ +- (OSSTask *)continueWithBlock:(OSSContinuationBlock)block cancellationToken:(nullable OSSCancellationToken *)cancellationToken; + +/*! + Enqueues the given block to be run once this task is complete. + @param executor A OSSExecutor responsible for determining how the + continuation block will be run. + @param block The block to be run once this task is complete. + @returns A task that will be completed after block has run. + If block returns a OSSTask, then the task returned from + this method will not be completed until that task is completed. + */ +- (OSSTask *)continueWithExecutor:(OSSExecutor *)executor withBlock:(OSSContinuationBlock)block; +/*! + Enqueues the given block to be run once this task is complete. + @param executor A OSSExecutor responsible for determining how the + continuation block will be run. + @param block The block to be run once this task is complete. + @param cancellationToken The cancellation token (optional). + @returns A task that will be completed after block has run. + If block returns a OSSTask, then the task returned from + his method will not be completed until that task is completed. + */ +- (OSSTask *)continueWithExecutor:(OSSExecutor *)executor + block:(OSSContinuationBlock)block + cancellationToken:(nullable OSSCancellationToken *)cancellationToken; + +/*! + Identical to continueWithBlock:, except that the block is only run + if this task did not produce a cancellation, error, or exception. + If it did, then the failure will be propagated to the returned + task. + @param block The block to be run once this task is complete. + @returns A task that will be completed after block has run. + If block returns a OSSTask, then the task returned from + this method will not be completed until that task is completed. + */ +- (OSSTask *)continueWithSuccessBlock:(OSSContinuationBlock)block; + +/*! + Identical to continueWithBlock:, except that the block is only run + if this task did not produce a cancellation, error, or exception. + If it did, then the failure will be propagated to the returned + task. + @param block The block to be run once this task is complete. + @param cancellationToken The cancellation token (optional). + @returns A task that will be completed after block has run. + If block returns a OSSTask, then the task returned from + this method will not be completed until that task is completed. + */ +- (OSSTask *)continueWithSuccessBlock:(OSSContinuationBlock)block cancellationToken:(nullable OSSCancellationToken *)cancellationToken; + +/*! + Identical to continueWithExecutor:withBlock:, except that the block + is only run if this task did not produce a cancellation, error, or + exception. If it did, then the failure will be propagated to the + returned task. + @param executor A OSSExecutor responsible for determining how the + continuation block will be run. + @param block The block to be run once this task is complete. + @returns A task that will be completed after block has run. + If block returns a OSSTask, then the task returned from + this method will not be completed until that task is completed. + */ +- (OSSTask *)continueWithExecutor:(OSSExecutor *)executor withSuccessBlock:(OSSContinuationBlock)block; + +/*! + Identical to continueWithExecutor:withBlock:, except that the block + is only run if this task did not produce a cancellation, error, or + exception. If it did, then the failure will be propagated to the + returned task. + @param executor A OSSExecutor responsible for determining how the + continuation block will be run. + @param block The block to be run once this task is complete. + @param cancellationToken The cancellation token (optional). + @returns A task that will be completed after block has run. + If block returns a OSSTask, then the task returned from + this method will not be completed until that task is completed. + */ +- (OSSTask *)continueWithExecutor:(OSSExecutor *)executor + successBlock:(OSSContinuationBlock)block + cancellationToken:(nullable OSSCancellationToken *)cancellationToken; + +/*! + Waits until this operation is completed. + This method is inefficient and consumes a thread resource while + it's running. It should be avoided. This method logs a warning + message if it is used on the main thread. + */ +- (void)waitUntilFinished; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Example/ios/AliyunOSSiOS.framework/Headers/OSSTaskCompletionSource.h b/Example/ios/AliyunOSSiOS.framework/Headers/OSSTaskCompletionSource.h new file mode 100644 index 0000000..bc29536 --- /dev/null +++ b/Example/ios/AliyunOSSiOS.framework/Headers/OSSTaskCompletionSource.h @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class OSSTask; + +/*! + A OSSTaskCompletionSource represents the producer side of tasks. + It is a task that also has methods for changing the state of the + task by settings its completion values. + */ +@interface OSSTaskCompletionSource<__covariant ResultType> : NSObject + +/*! + Creates a new unfinished task. + */ ++ (instancetype)taskCompletionSource; + +/*! + The task associated with this TaskCompletionSource. + */ +@property (nonatomic, strong, readonly) OSSTask *task; + +/*! + Completes the task by setting the result. + Attempting to set this for a completed task will raise an exception. + @param result The result of the task. + */ +- (void)setResult:(nullable ResultType)result; + +/*! + Completes the task by setting the error. + Attempting to set this for a completed task will raise an exception. + @param error The error for the task. + */ +- (void)setError:(NSError *)error; + +/*! + Completes the task by setting an exception. + Attempting to set this for a completed task will raise an exception. + @param exception The exception for the task. + */ +- (void)setException:(NSException *)exception; + +/*! + Completes the task by marking it as cancelled. + Attempting to set this for a completed task will raise an exception. + */ +- (void)cancel; + +/*! + Sets the result of the task if it wasn't already completed. + @returns whether the new value was set. + */ +- (BOOL)trySetResult:(nullable ResultType)result; + +/*! + Sets the error of the task if it wasn't already completed. + @param error The error for the task. + @returns whether the new value was set. + */ +- (BOOL)trySetError:(NSError *)error; + +/*! + Sets the exception of the task if it wasn't already completed. + @param exception The exception for the task. + @returns whether the new value was set. + */ +- (BOOL)trySetException:(NSException *)exception; + +/*! + Sets the cancellation state of the task if it wasn't already completed. + @returns whether the new value was set. + */ +- (BOOL)trySetCancelled; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Example/ios/AliyunOSSiOS.framework/Headers/OSSUtil.h b/Example/ios/AliyunOSSiOS.framework/Headers/OSSUtil.h new file mode 100644 index 0000000..b06b3df --- /dev/null +++ b/Example/ios/AliyunOSSiOS.framework/Headers/OSSUtil.h @@ -0,0 +1,37 @@ +// +// OSSUtil.h +// oss_ios_sdk +// +// Created by zhouzhuo on 8/16/15. +// Copyright (c) 2015 aliyun.com. All rights reserved. +// + +#import + +@class OSSFederationToken; + +@interface OSSUtil : NSObject + ++ (NSString *)calBase64Sha1WithData:(NSString *)data withSecret:(NSString *)key; ++ (NSString *)calBase64WithData:(uint8_t *)data; ++ (NSString *)encodeURL:(NSString *)url; ++ (NSData *)constructHttpBodyFromPartInfos:(NSArray *)partInfos; ++ (NSData *)constructHttpBodyForCreateBucketWithLocation:(NSString *)location; ++ (BOOL)validateBucketName:(NSString *)bucketName; ++ (BOOL)validateObjectKey:(NSString *)objectKey; ++ (BOOL)isOssOriginBucketHost:(NSString *)host; ++ (NSString *)getIpByHost:(NSString *)host; ++ (BOOL)isNetworkDelegateState; ++ (NSString *)dataMD5String:(NSData *)data; ++ (NSString *)fileMD5String:(NSString *)path; ++ (NSString*)base64ForData:(uint8_t *)input length:(int32_t)length; ++ (NSString *)base64Md5ForData:(NSData *)data; ++ (NSString *)base64Md5ForFilePath:(NSString *)filePath; ++ (NSString *)base64Md5ForFileURL:(NSURL *)fileURL; ++ (NSString *)populateSubresourceStringFromParameter:(NSDictionary *)parameters; ++ (NSString *)populateQueryStringFromParameter:(NSDictionary *)parameters; ++ (BOOL)isSubresource:(NSString *)param; ++ (NSString *)sign:(NSString *)content withToken:(OSSFederationToken *)token; ++ (NSString *)getRelativePath:(NSString *)fullPath; ++ (NSString *)detemineMimeTypeForFilePath:(NSString *)filePath uploadName:(NSString *)uploadName; +@end diff --git a/Example/ios/AliyunOSSiOS.framework/Modules/module.modulemap b/Example/ios/AliyunOSSiOS.framework/Modules/module.modulemap new file mode 100644 index 0000000..f11ad37 --- /dev/null +++ b/Example/ios/AliyunOSSiOS.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module AliyunOSSiOS { + umbrella header "AliyunOSSiOS.h" + + export * + module * { export * } +} diff --git a/Example/ios/Example.xcodeproj/project.pbxproj b/Example/ios/Example.xcodeproj/project.pbxproj index 471e0c5..6a53baa 100644 --- a/Example/ios/Example.xcodeproj/project.pbxproj +++ b/Example/ios/Example.xcodeproj/project.pbxproj @@ -40,7 +40,6 @@ 3EEFBBCF20CCF44400A55F2E /* libresolv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EEFBBCE20CCF44400A55F2E /* libresolv.tbd */; }; 3EEFBBD120CCF45200A55F2E /* CoreTelephony.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EEFBBD020CCF45200A55F2E /* CoreTelephony.framework */; }; 3EEFBBD320CCF45B00A55F2E /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EEFBBD220CCF45B00A55F2E /* SystemConfiguration.framework */; }; - 3EEFBC3E20CCF79B00A55F2E /* AliyunOSSiOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3EEFBC3D20CCF79A00A55F2E /* AliyunOSSiOS.framework */; }; 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; }; 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; }; @@ -215,6 +214,76 @@ remoteGlobalIDString = 3D3CD9181DE5FBD800167DC4; remoteInfo = "jschelpers-tvOS"; }; + 3EA1B26520EB49E9006F8C30 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 3DBE0D001F3B181A0099AA32; + remoteInfo = fishhook; + }; + 3EA1B26720EB49E9006F8C30 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 3DBE0D0D1F3B181C0099AA32; + remoteInfo = "fishhook-tvOS"; + }; + 3EA1B27920EB49E9006F8C30 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = EBF21BDC1FC498900052F4D5; + remoteInfo = jsinspector; + }; + 3EA1B27B20EB49E9006F8C30 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = EBF21BFA1FC4989A0052F4D5; + remoteInfo = "jsinspector-tvOS"; + }; + 3EA1B27D20EB49E9006F8C30 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 139D7ECE1E25DB7D00323FB7; + remoteInfo = "third-party"; + }; + 3EA1B27F20EB49E9006F8C30 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 3D383D3C1EBD27B6005632C8; + remoteInfo = "third-party-tvOS"; + }; + 3EA1B28120EB49E9006F8C30 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 139D7E881E25C6D100323FB7; + remoteInfo = "double-conversion"; + }; + 3EA1B28320EB49E9006F8C30 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 3D383D621EBD27B9005632C8; + remoteInfo = "double-conversion-tvOS"; + }; + 3EA1B28520EB49E9006F8C30 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 9936F3131F5F2E4B0010BF04; + remoteInfo = privatedata; + }; + 3EA1B28720EB49E9006F8C30 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 9936F32F1F5F2E5B0010BF04; + remoteInfo = "privatedata-tvOS"; + }; 3EEFBC3820CCF73300A55F2E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 46BEA5E531C04237A969A4C2 /* RNAliyunOSS.xcodeproj */; @@ -292,7 +361,6 @@ 3EEFBBCE20CCF44400A55F2E /* libresolv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libresolv.tbd; path = usr/lib/libresolv.tbd; sourceTree = SDKROOT; }; 3EEFBBD020CCF45200A55F2E /* CoreTelephony.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreTelephony.framework; path = System/Library/Frameworks/CoreTelephony.framework; sourceTree = SDKROOT; }; 3EEFBBD220CCF45B00A55F2E /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; - 3EEFBC3D20CCF79A00A55F2E /* AliyunOSSiOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AliyunOSSiOS.framework; path = "../node_modules/aliyun-oss-react-native/ios/AliyunSDK/AliyunOSSiOS.framework"; sourceTree = ""; }; 46BEA5E531C04237A969A4C2 /* RNAliyunOSS.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNAliyunOSS.xcodeproj; path = "../node_modules/aliyun-oss-react-native/ios/RNAliyunOSS.xcodeproj"; sourceTree = ""; }; 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = ""; }; 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; @@ -331,7 +399,6 @@ 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */, 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, - 3EEFBC3E20CCF79B00A55F2E /* AliyunOSSiOS.framework in Frameworks */, 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, 007900295C044ECCBA7BE212 /* libRNAliyunOSS.a in Frameworks */, 00341B0CCE814E85BA2A8217 /* libRNImagePicker.a in Frameworks */, @@ -437,6 +504,8 @@ children = ( 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */, 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */, + 3EA1B26620EB49E9006F8C30 /* libfishhook.a */, + 3EA1B26820EB49E9006F8C30 /* libfishhook-tvOS.a */, ); name = Products; sourceTree = ""; @@ -466,6 +535,14 @@ 3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */, 3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */, 3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */, + 3EA1B27A20EB49E9006F8C30 /* libjsinspector.a */, + 3EA1B27C20EB49E9006F8C30 /* libjsinspector-tvOS.a */, + 3EA1B27E20EB49E9006F8C30 /* libthird-party.a */, + 3EA1B28020EB49E9006F8C30 /* libthird-party.a */, + 3EA1B28220EB49E9006F8C30 /* libdouble-conversion.a */, + 3EA1B28420EB49E9006F8C30 /* libdouble-conversion.a */, + 3EA1B28620EB49E9006F8C30 /* libprivatedata.a */, + 3EA1B28820EB49E9006F8C30 /* libprivatedata-tvOS.a */, ); name = Products; sourceTree = ""; @@ -473,7 +550,6 @@ 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { isa = PBXGroup; children = ( - 3EEFBC3D20CCF79A00A55F2E /* AliyunOSSiOS.framework */, 3EEFBBD220CCF45B00A55F2E /* SystemConfiguration.framework */, 3EEFBBD020CCF45200A55F2E /* CoreTelephony.framework */, 3EEFBBCE20CCF44400A55F2E /* libresolv.tbd */, @@ -923,6 +999,76 @@ remoteRef = 3DAD3EAE1DF850E9000B6D8A /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + 3EA1B26620EB49E9006F8C30 /* libfishhook.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libfishhook.a; + remoteRef = 3EA1B26520EB49E9006F8C30 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3EA1B26820EB49E9006F8C30 /* libfishhook-tvOS.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libfishhook-tvOS.a"; + remoteRef = 3EA1B26720EB49E9006F8C30 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3EA1B27A20EB49E9006F8C30 /* libjsinspector.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libjsinspector.a; + remoteRef = 3EA1B27920EB49E9006F8C30 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3EA1B27C20EB49E9006F8C30 /* libjsinspector-tvOS.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libjsinspector-tvOS.a"; + remoteRef = 3EA1B27B20EB49E9006F8C30 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3EA1B27E20EB49E9006F8C30 /* libthird-party.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libthird-party.a"; + remoteRef = 3EA1B27D20EB49E9006F8C30 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3EA1B28020EB49E9006F8C30 /* libthird-party.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libthird-party.a"; + remoteRef = 3EA1B27F20EB49E9006F8C30 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3EA1B28220EB49E9006F8C30 /* libdouble-conversion.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libdouble-conversion.a"; + remoteRef = 3EA1B28120EB49E9006F8C30 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3EA1B28420EB49E9006F8C30 /* libdouble-conversion.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libdouble-conversion.a"; + remoteRef = 3EA1B28320EB49E9006F8C30 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3EA1B28620EB49E9006F8C30 /* libprivatedata.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libprivatedata.a; + remoteRef = 3EA1B28520EB49E9006F8C30 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3EA1B28820EB49E9006F8C30 /* libprivatedata-tvOS.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = "libprivatedata-tvOS.a"; + remoteRef = 3EA1B28720EB49E9006F8C30 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; 3EEFBC3920CCF73300A55F2E /* libRNAliyunOSS.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -1165,6 +1311,10 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CURRENT_PROJECT_VERSION = 1; DEAD_CODE_STRIPPING = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)/../node_modules/aliyun-oss-react-native/ios/**", @@ -1187,6 +1337,10 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CURRENT_PROJECT_VERSION = 1; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); HEADER_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)/../node_modules/aliyun-oss-react-native/ios/**", diff --git a/ios/RNAliyunOSS.xcodeproj/project.pbxproj b/ios/RNAliyunOSS.xcodeproj/project.pbxproj index bf8b76d..b4904c2 100644 --- a/ios/RNAliyunOSS.xcodeproj/project.pbxproj +++ b/ios/RNAliyunOSS.xcodeproj/project.pbxproj @@ -8,6 +8,13 @@ /* Begin PBXBuildFile section */ 1842ED021EEBA70B004D40E3 /* RNAliyunOSS.m in Sources */ = {isa = PBXBuildFile; fileRef = 1842ED011EEBA70B004D40E3 /* RNAliyunOSS.m */; }; + 3E200E7C20EB5DA5002AF220 /* RNAliyunOSS+UPLOAD.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E200E6F20EB5DA5002AF220 /* RNAliyunOSS+UPLOAD.m */; }; + 3E200E7D20EB5DA5002AF220 /* RNAliyunOSS+BUCKET.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E200E7320EB5DA5002AF220 /* RNAliyunOSS+BUCKET.m */; }; + 3E200E7E20EB5DA5002AF220 /* RNAliyunOSS+OBJECT.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E200E7420EB5DA5002AF220 /* RNAliyunOSS+OBJECT.m */; }; + 3E200E7F20EB5DA5002AF220 /* RNAliyunOSS+MULTIPARTUPLOAD.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E200E7720EB5DA5002AF220 /* RNAliyunOSS+MULTIPARTUPLOAD.m */; }; + 3E200E8020EB5DA5002AF220 /* RNAliyunOSS+DOWNLOAD.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E200E7920EB5DA5002AF220 /* RNAliyunOSS+DOWNLOAD.m */; }; + 3E200E8120EB5DA5002AF220 /* RNAliyunOSS+AUTH.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E200E7A20EB5DA5002AF220 /* RNAliyunOSS+AUTH.m */; }; + 3E200E8220EB5DA5002AF220 /* RNAliyunOSS+LOG.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E200E7B20EB5DA5002AF220 /* RNAliyunOSS+LOG.m */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -27,6 +34,20 @@ 1842ED001EEBA70B004D40E3 /* RNAliyunOSS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNAliyunOSS.h; sourceTree = ""; }; 1842ED011EEBA70B004D40E3 /* RNAliyunOSS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNAliyunOSS.m; sourceTree = ""; }; 186899B21F31997000841D5D /* AliyunOSSiOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AliyunOSSiOS.framework; path = AliyunSDK/AliyunOSSiOS.framework; sourceTree = ""; }; + 3E200E6E20EB5DA5002AF220 /* RNAliyunOSS+BUCKET.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RNAliyunOSS+BUCKET.h"; sourceTree = ""; }; + 3E200E6F20EB5DA5002AF220 /* RNAliyunOSS+UPLOAD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RNAliyunOSS+UPLOAD.m"; sourceTree = ""; }; + 3E200E7020EB5DA5002AF220 /* RNAliyunOSS+AUTH.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RNAliyunOSS+AUTH.h"; sourceTree = ""; }; + 3E200E7120EB5DA5002AF220 /* RNAliyunOSS+DOWNLOAD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RNAliyunOSS+DOWNLOAD.h"; sourceTree = ""; }; + 3E200E7220EB5DA5002AF220 /* RNAliyunOSS+LOG.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RNAliyunOSS+LOG.h"; sourceTree = ""; }; + 3E200E7320EB5DA5002AF220 /* RNAliyunOSS+BUCKET.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RNAliyunOSS+BUCKET.m"; sourceTree = ""; }; + 3E200E7420EB5DA5002AF220 /* RNAliyunOSS+OBJECT.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RNAliyunOSS+OBJECT.m"; sourceTree = ""; }; + 3E200E7520EB5DA5002AF220 /* RNAliyunOSS+OBJECT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RNAliyunOSS+OBJECT.h"; sourceTree = ""; }; + 3E200E7620EB5DA5002AF220 /* RNAliyunOSS+MULTIPARTUPLOAD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RNAliyunOSS+MULTIPARTUPLOAD.h"; sourceTree = ""; }; + 3E200E7720EB5DA5002AF220 /* RNAliyunOSS+MULTIPARTUPLOAD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RNAliyunOSS+MULTIPARTUPLOAD.m"; sourceTree = ""; }; + 3E200E7820EB5DA5002AF220 /* RNAliyunOSS+UPLOAD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RNAliyunOSS+UPLOAD.h"; sourceTree = ""; }; + 3E200E7920EB5DA5002AF220 /* RNAliyunOSS+DOWNLOAD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RNAliyunOSS+DOWNLOAD.m"; sourceTree = ""; }; + 3E200E7A20EB5DA5002AF220 /* RNAliyunOSS+AUTH.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RNAliyunOSS+AUTH.m"; sourceTree = ""; }; + 3E200E7B20EB5DA5002AF220 /* RNAliyunOSS+LOG.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RNAliyunOSS+LOG.m"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -59,6 +80,20 @@ 58B511D21A9E6C8500147676 = { isa = PBXGroup; children = ( + 3E200E7020EB5DA5002AF220 /* RNAliyunOSS+AUTH.h */, + 3E200E7A20EB5DA5002AF220 /* RNAliyunOSS+AUTH.m */, + 3E200E6E20EB5DA5002AF220 /* RNAliyunOSS+BUCKET.h */, + 3E200E7320EB5DA5002AF220 /* RNAliyunOSS+BUCKET.m */, + 3E200E7120EB5DA5002AF220 /* RNAliyunOSS+DOWNLOAD.h */, + 3E200E7920EB5DA5002AF220 /* RNAliyunOSS+DOWNLOAD.m */, + 3E200E7220EB5DA5002AF220 /* RNAliyunOSS+LOG.h */, + 3E200E7B20EB5DA5002AF220 /* RNAliyunOSS+LOG.m */, + 3E200E7620EB5DA5002AF220 /* RNAliyunOSS+MULTIPARTUPLOAD.h */, + 3E200E7720EB5DA5002AF220 /* RNAliyunOSS+MULTIPARTUPLOAD.m */, + 3E200E7520EB5DA5002AF220 /* RNAliyunOSS+OBJECT.h */, + 3E200E7420EB5DA5002AF220 /* RNAliyunOSS+OBJECT.m */, + 3E200E7820EB5DA5002AF220 /* RNAliyunOSS+UPLOAD.h */, + 3E200E6F20EB5DA5002AF220 /* RNAliyunOSS+UPLOAD.m */, 186899B11F31993900841D5D /* AliyunSDK */, 1842ED001EEBA70B004D40E3 /* RNAliyunOSS.h */, 1842ED011EEBA70B004D40E3 /* RNAliyunOSS.m */, @@ -122,7 +157,14 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 3E200E8220EB5DA5002AF220 /* RNAliyunOSS+LOG.m in Sources */, + 3E200E7E20EB5DA5002AF220 /* RNAliyunOSS+OBJECT.m in Sources */, + 3E200E8120EB5DA5002AF220 /* RNAliyunOSS+AUTH.m in Sources */, + 3E200E7C20EB5DA5002AF220 /* RNAliyunOSS+UPLOAD.m in Sources */, + 3E200E7D20EB5DA5002AF220 /* RNAliyunOSS+BUCKET.m in Sources */, + 3E200E7F20EB5DA5002AF220 /* RNAliyunOSS+MULTIPARTUPLOAD.m in Sources */, 1842ED021EEBA70B004D40E3 /* RNAliyunOSS.m in Sources */, + 3E200E8020EB5DA5002AF220 /* RNAliyunOSS+DOWNLOAD.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; };