Skip to content

Commit 4884044

Browse files
committed
format
1 parent ba91cb5 commit 4884044

12 files changed

+159
-162
lines changed

CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
#Changelog
22

3+
## 7.1.3 (2016-11-07)
4+
## 增加
5+
* 增加zoneNa0 北美
6+
37
## 7.1.2 (2016-10-11)
48
## 增加
5-
* 增加zone2
9+
* 增加zone2 华南
610

711
## 7.1.1 (2016-09-08)
812
## 改变

QiniuSDK/Common/QNPHAssetFile.m

100755100644
+42-45
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ - (instancetype)init:(PHAsset *)phAsset error:(NSError *__autoreleasing *)error
7676
_file = f;
7777
_assetData = d;
7878
}
79-
8079
}
8180
return self;
8281
}
@@ -97,10 +96,8 @@ - (void)close {
9796
if (PHAssetMediaTypeVideo == self.phAsset.mediaType) {
9897
if (_file != nil) {
9998
[_file closeFile];
100-
10199
}
102-
[[NSFileManager defaultManager] removeItemAtPath: _filepath error: nil];
103-
100+
[[NSFileManager defaultManager] removeItemAtPath:_filepath error:nil];
104101
}
105102
}
106103

@@ -117,50 +114,50 @@ - (int64_t)size {
117114
}
118115

119116
- (NSString *)getInfo {
120-
__block NSString * filePath = nil;
117+
__block NSString *filePath = nil;
121118
if (PHAssetMediaTypeImage == self.phAsset.mediaType) {
122-
PHImageRequestOptions *options = [PHImageRequestOptions new];
123-
options.version = PHImageRequestOptionsVersionCurrent;
124-
options.deliveryMode = PHImageRequestOptionsDeliveryModeHighQualityFormat;
125-
options.resizeMode = PHImageRequestOptionsResizeModeNone;
126-
//不支持icloud上传
127-
options.networkAccessAllowed = NO;
128-
options.synchronous = YES;
129-
130-
[[PHImageManager defaultManager] requestImageDataForAsset:self.phAsset
131-
options:options
132-
resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {
133-
_assetData = imageData;
134-
_fileSize = imageData.length;
135-
_assetURL = [NSURL URLWithString:self.phAsset.localIdentifier];
136-
filePath = _assetURL.path;
137-
}];
138-
} else if (PHAssetMediaTypeVideo == self.phAsset.mediaType) {
139-
NSArray * assetResources = [PHAssetResource assetResourcesForAsset: self.phAsset];
140-
PHAssetResource * resource;
141-
for (PHAssetResource * assetRes in assetResources) {
142-
if (assetRes.type == PHAssetResourceTypePairedVideo || assetRes.type == PHAssetResourceTypeVideo) {
143-
resource = assetRes;
144-
}
119+
PHImageRequestOptions *options = [PHImageRequestOptions new];
120+
options.version = PHImageRequestOptionsVersionCurrent;
121+
options.deliveryMode = PHImageRequestOptionsDeliveryModeHighQualityFormat;
122+
options.resizeMode = PHImageRequestOptionsResizeModeNone;
123+
//不支持icloud上传
124+
options.networkAccessAllowed = NO;
125+
options.synchronous = YES;
126+
127+
[[PHImageManager defaultManager] requestImageDataForAsset:self.phAsset
128+
options:options
129+
resultHandler:^(NSData *imageData, NSString *dataUTI, UIImageOrientation orientation, NSDictionary *info) {
130+
_assetData = imageData;
131+
_fileSize = imageData.length;
132+
_assetURL = [NSURL URLWithString:self.phAsset.localIdentifier];
133+
filePath = _assetURL.path;
134+
}];
135+
} else if (PHAssetMediaTypeVideo == self.phAsset.mediaType) {
136+
NSArray *assetResources = [PHAssetResource assetResourcesForAsset:self.phAsset];
137+
PHAssetResource *resource;
138+
for (PHAssetResource *assetRes in assetResources) {
139+
if (assetRes.type == PHAssetResourceTypePairedVideo || assetRes.type == PHAssetResourceTypeVideo) {
140+
resource = assetRes;
145141
}
146-
NSString * fileName = @"tempAssetVideo.mov";
147-
if (resource.originalFilename) {
148-
fileName = resource.originalFilename;
142+
}
143+
NSString *fileName = @"tempAssetVideo.mov";
144+
if (resource.originalFilename) {
145+
fileName = resource.originalFilename;
146+
}
147+
PHVideoRequestOptions *options = [[PHVideoRequestOptions alloc] init];
148+
options.version = PHImageRequestOptionsVersionCurrent;
149+
//不支持icloud上传
150+
options.networkAccessAllowed = NO;
151+
options.deliveryMode = PHVideoRequestOptionsDeliveryModeAutomatic;
152+
NSString *PATH_VIDEO_FILE = [NSTemporaryDirectory() stringByAppendingPathComponent:fileName];
153+
[[NSFileManager defaultManager] removeItemAtPath:PATH_VIDEO_FILE error:nil];
154+
[[PHAssetResourceManager defaultManager] writeDataForAssetResource:resource toFile:[NSURL fileURLWithPath:PATH_VIDEO_FILE] options:options completionHandler:^(NSError *_Nullable error) {
155+
if (error) {
156+
filePath = nil;
157+
} else {
158+
filePath = PATH_VIDEO_FILE;
149159
}
150-
PHVideoRequestOptions * options = [[PHVideoRequestOptions alloc] init];
151-
options.version = PHImageRequestOptionsVersionCurrent;
152-
//不支持icloud上传
153-
options.networkAccessAllowed = NO;
154-
options.deliveryMode = PHVideoRequestOptionsDeliveryModeAutomatic;
155-
NSString * PATH_VIDEO_FILE = [NSTemporaryDirectory() stringByAppendingPathComponent: fileName];
156-
[[NSFileManager defaultManager] removeItemAtPath: PATH_VIDEO_FILE error: nil];
157-
[[PHAssetResourceManager defaultManager] writeDataForAssetResource: resource toFile: [NSURL fileURLWithPath: PATH_VIDEO_FILE] options: options completionHandler: ^(NSError * _Nullable error) {
158-
if (error) {
159-
filePath = nil;
160-
} else {
161-
filePath = PATH_VIDEO_FILE;
162-
}
163-
}];
160+
}];
164161
}
165162
return filePath;
166163
}

QiniuSDK/Common/QNVersion.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
/**
1212
* sdk 版本
1313
*/
14-
static const NSString *kQiniuVersion = @"7.1.2";
14+
static const NSString *kQiniuVersion = @"7.1.3";

QiniuSDK/Http/QNSessionManager.h

100755100644
+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
withCancelBlock:(QNCancelBlock)cancelBlock;
3131

3232
- (void)get:(NSString *)url
33-
withHeaders:(NSDictionary *)headers
34-
withCompleteBlock:(QNCompleteBlock)completeBlock;
33+
withHeaders:(NSDictionary *)headers
34+
withCompleteBlock:(QNCompleteBlock)completeBlock;
3535

3636
@end
3737

QiniuSDK/Http/QNSessionManager.m

+7-7
Original file line numberDiff line numberDiff line change
@@ -308,20 +308,20 @@ - (void)post:(NSString *)url
308308
}
309309

310310
- (void)get:(NSString *)url
311-
withHeaders:(NSDictionary *)headers
312-
withCompleteBlock:(QNCompleteBlock)completeBlock {
311+
withHeaders:(NSDictionary *)headers
312+
withCompleteBlock:(QNCompleteBlock)completeBlock {
313313
QNAsyncRun(^{
314314
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
315315
AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
316-
316+
317317
NSURL *URL = [NSURL URLWithString:url];
318318
NSURLRequest *request = [NSURLRequest requestWithURL:URL];
319-
319+
320320
NSURLSessionDataTask *dataTask = [manager dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
321321
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
322-
NSData* s = [@"{}" dataUsingEncoding:NSUTF8StringEncoding];
322+
NSData *s = [@"{}" dataUsingEncoding:NSUTF8StringEncoding];
323323
NSDictionary *resp = nil;
324-
QNResponseInfo* info;
324+
QNResponseInfo *info;
325325
if (error == nil) {
326326
info = [QNSessionManager buildResponseInfo:httpResponse withError:nil withDuration:0 withResponse:s withHost:@"" withIp:@""];
327327
if (info.isOK) {
@@ -330,7 +330,7 @@ - (void)get:(NSString *)url
330330
} else {
331331
info = [QNSessionManager buildResponseInfo:httpResponse withError:error withDuration:0 withResponse:s withHost:@"" withIp:@""];
332332
}
333-
333+
334334
completeBlock(info, resp);
335335
}];
336336
[dataTask resume];

QiniuSDK/Storage/QNConfiguration.h

100755100644
+5-6
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ typedef void (^QNPrequeryReturn)(int code);
9999
/**
100100
* 默认上传服务器地址
101101
*/
102-
- (QNServiceAddress *)up:(QNUpToken*)token;
102+
- (QNServiceAddress *)up:(QNUpToken *)token;
103103

104104
/**
105105
* 备用上传服务器地址
106106
*/
107-
- (QNServiceAddress *)upBackup:(QNUpToken*)token;
107+
- (QNServiceAddress *)upBackup:(QNUpToken *)token;
108108

109109
/**
110110
* zone 0
@@ -127,10 +127,10 @@ typedef void (^QNPrequeryReturn)(int code);
127127
*/
128128
+ (instancetype)zone2;
129129

130-
- (void)preQuery:(QNUpToken*)token
130+
- (void)preQuery:(QNUpToken *)token
131131
on:(QNPrequeryReturn)ret;
132132

133-
+ (void)addIpToDns:(QNDnsManager*)dns;
133+
+ (void)addIpToDns:(QNDnsManager *)dns;
134134

135135
@end
136136

@@ -152,8 +152,7 @@ typedef void (^QNPrequeryReturn)(int code);
152152
@interface QNAutoZone : QNZone
153153

154154
- (instancetype)initWithHttps:(BOOL)flag
155-
dns:(QNDnsManager*)dns;
156-
155+
dns:(QNDnsManager *)dns;
157156

158157
@end
159158

0 commit comments

Comments
 (0)