Skip to content

Commit

Permalink
# 5.4.2
Browse files Browse the repository at this point in the history
- 修复了返回数组类型的属性,如果数组内容只有一个时候会解析失败的问题。
  • Loading branch information
erichmzhang committed Apr 2, 2018
1 parent 0ee75b0 commit c39d602
Show file tree
Hide file tree
Showing 26 changed files with 179 additions and 181 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 5.4.2
- 修复了返回数组类型的属性,如果数组内容只有一个时候会解析失败的问题。

# 5.4.1
- 修复了 XML 中以 / 结尾的 Object 会403的的问题。

Expand Down
6 changes: 3 additions & 3 deletions QCloudCOSXML.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "QCloudCOSXML"
s.version = "5.4.1"
s.version = "5.4.2"
s.summary = "QCloudCOSXML 腾讯云iOS-SDK组件"

s.homepage = "https://cloud.tencent.com/"
Expand All @@ -9,10 +9,10 @@ s.version = "5.4.1"
s.source = { :git => "https://github.com/tencentyun/qcloud-sdk-ios.git", :tag => s.version.to_s }
s.ios.deployment_target = '8.0'
s.source_files = 'QCloudCOSXML/Classes/**/*'
s.dependency "QCloudCore",'5.4.1'
s.dependency "QCloudCore",'5.4.2'

s.subspec 'Transfer' do |sbt|
sbt.source_files = 'QCloudCOSXML/Classes/Transfer/*','QCloudCOSXML/Classes/Base/*'
sbt.dependency "QCloudCore",'5.4.1'
sbt.dependency "QCloudCore",'5.4.2'
end
end
7 changes: 7 additions & 0 deletions QCloudCOSXML/Classes/Base/QCloudCOSXMLEndPoint.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,11 @@ - (NSURL*) serverURLWithBucket:(NSString *)bucket appID:(NSString *)appID
NSURL* serverURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://%@-%@.%@.%@",scheme,formattedBucketName,appID,formattedRegionName,self.serviceName]];
return serverURL;
}

- (id)copyWithZone:(NSZone *)zone {
QCloudCOSXMLEndPoint* endpoint = [[QCloudCOSXMLEndPoint alloc] init];
endpoint.regionName = self.regionName;
endpoint.serviceName = self.serviceName;
return endpoint;
}
@end
9 changes: 9 additions & 0 deletions QCloudCOSXML/Classes/Base/QCloudCOSXMLService.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@
#pragma Factory
+ (QCloudCOSXMLService*) defaultCOSXML;
+ (QCloudCOSXMLService*) cosxmlServiceForKey:(NSString*)key;

/**
检查是否存在key对应的service
@param key key
@return 存在与否
*/
+ (BOOL) hasServiceForKey:(NSString*)key;
+ (QCloudCOSXMLService*) registerDefaultCOSXMLWithConfiguration:(QCloudServiceConfiguration*)configuration;
+ (QCloudCOSXMLService*) registerCOSXMLWithConfiguration:(QCloudServiceConfiguration*)configuration withKey:(NSString*)key;
+ (void) removeCOSXMLWithKey:(NSString*)key;
Expand Down
8 changes: 8 additions & 0 deletions QCloudCOSXML/Classes/Base/QCloudCOSXMLService.m
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,13 @@ - (NSString*)getURLWithBucket:(NSString *)bucket object:(NSString *)object withA
return [resultURL copy];
}

+ (BOOL)hasServiceForKey:(NSString *)key {
if (nil == [QCloudCOSXMLServiceCache() objectForKey:key]) {
return NO;
} else {
return YES;
}
}


@end
4 changes: 2 additions & 2 deletions QCloudCOSXML/Classes/Manager/QCloudACLPolicy.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#import <Foundation/Foundation.h>
#import <QCloudCore/QCloudCore.h>
#import "QCloudACLOwner.h"
#import "QCloudACLGrant.h"
#import "QCloudAccessControlList.h"

NS_ASSUME_NONNULL_BEGIN
@interface QCloudACLPolicy : NSObject
Expand All @@ -39,6 +39,6 @@ NS_ASSUME_NONNULL_BEGIN
/**
被授权者与权限的信息
*/
@property (strong, nonatomic) NSArray<QCloudACLGrant*> *accessControlList;
@property (strong, nonatomic) QCloudAccessControlList *accessControlList;
@end
NS_ASSUME_NONNULL_END
50 changes: 1 addition & 49 deletions QCloudCOSXML/Classes/Manager/QCloudACLPolicy.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,12 @@
#import "QCloudACLPolicy.h"

#import "QCloudACLOwner.h"
#import "QCloudACLGrant.h"
#import "QCloudAccessControlList.h"

@class QCloudACLGrant;

NS_ASSUME_NONNULL_BEGIN
@implementation QCloudACLPolicy

+ (NSDictionary *)modelContainerPropertyGenericClass
{
return @ {
@"accessControlList":[QCloudACLGrant class],
};
}


+ (NSDictionary *)modelCustomPropertyMapper
Expand All @@ -53,22 +46,6 @@ + (NSDictionary *)modelCustomPropertyMapper

- (BOOL)modelCustomTransformToDictionary:(NSMutableDictionary *)dic
{
void(^TransformDictionary)(NSString* originKey, NSString* aimKey) = ^(NSString* originKey, NSString* aimKey) {
id object = [dic objectForKey:originKey];
if (!object) {
return;
}
if ([object isKindOfClass:[NSNull class]]) {
return;
}
if ([object isKindOfClass:[NSArray class]]) {
NSArray* objects = (NSArray*)object;
[dic removeObjectForKey:originKey];
NSMutableDictionary* transferDic = [@{aimKey:objects} mutableCopy];
[dic setObject:transferDic forKey:originKey];
}
};
TransformDictionary(@"AccessControlList", @"Grant");


return YES;
Expand All @@ -80,31 +57,6 @@ - (NSDictionary *)modelCustomWillTransformFromDictionary:(NSDictionary *)dic
return dic;
}
NSMutableDictionary* transfromDic = [NSMutableDictionary dictionaryWithDictionary:dic];
NSArray* transformArrayKeypaths = @[
@"AccessControlList",
];

for (NSString* keyPath in transformArrayKeypaths) {
id object = [dic valueForKeyPath:keyPath];
if (!object) {
continue;
}
if ([object isKindOfClass:[NSNull class]]) {
continue;
}
if (![object isKindOfClass:[NSArray class]]) {
if ([object isKindOfClass:[NSDictionary class]] && [(NSDictionary*)object count] == 1) {
id value = [[object allValues] firstObject];
if ([value isKindOfClass:[NSArray class]]) {
[transfromDic setValue:value forKey:keyPath];
} else {
[transfromDic setValue:@[value] forKey:keyPath];
}
} else {
[transfromDic setValue:@[object] forKeyPath:keyPath];
}
}
}

return transfromDic;
}
Expand Down
39 changes: 39 additions & 0 deletions QCloudCOSXML/Classes/Manager/QCloudAccessControlList.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// QCloudAccessControlList.h
// QCloudAccessControlList
//
// Created by tencent
// Copyright (c) 2015年 tencent. All rights reserved.
//
// ██████╗ ██████╗██╗ ██████╗ ██╗ ██╗██████╗ ████████╗███████╗██████╗ ███╗ ███╗██╗███╗ ██╗ █████╗ ██╗ ██╗ █████╗ ██████╗
// ██╔═══██╗██╔════╝██║ ██╔═══██╗██║ ██║██╔══██╗ ╚══██╔══╝██╔════╝██╔══██╗████╗ ████║██║████╗ ██║██╔══██╗██║ ██║ ██╔══██╗██╔══██╗
// ██║ ██║██║ ██║ ██║ ██║██║ ██║██║ ██║ ██║ █████╗ ██████╔╝██╔████╔██║██║██╔██╗ ██║███████║██║ ██║ ███████║██████╔╝
// ██║▄▄ ██║██║ ██║ ██║ ██║██║ ██║██║ ██║ ██║ ██╔══╝ ██╔══██╗██║╚██╔╝██║██║██║╚██╗██║██╔══██║██║ ██║ ██╔══██║██╔══██╗
// ╚██████╔╝╚██████╗███████╗╚██████╔╝╚██████╔╝██████╔╝ ██║ ███████╗██║ ██║██║ ╚═╝ ██║██║██║ ╚████║██║ ██║███████╗ ███████╗██║ ██║██████╔╝
// ╚══▀▀═╝ ╚═════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝ ╚══════╝╚═╝ ╚═╝╚═════╝
//
//
// _ __ _ _
// (_) / _| | | | |
// ___ ___ _ ____ ___ ___ ___ | |_ ___ _ __ __| | _____ _____| | ___ _ __ ___ _ __ ___
// / __|/ _ \ '__\ \ / / |/ __/ _ \ | _/ _ \| '__| / _` |/ _ \ \ / / _ \ |/ _ \| '_ \ / _ \ '__/ __|
// \__ \ __/ | \ V /| | (_| __/ | || (_) | | | (_| | __/\ V / __/ | (_) | |_) | __/ | \__
// |___/\___|_| \_/ |_|\___\___| |_| \___/|_| \__,_|\___| \_/ \___|_|\___/| .__/ \___|_| |___/
// ______ ______ ______ ______ ______ ______ ______ ______ | |
// |______|______|______|______|______|______|______|______| |_|
//



#import <Foundation/Foundation.h>
#import <QCloudCore/QCloudCore.h>
#import "QCloudACLGrant.h"

NS_ASSUME_NONNULL_BEGIN
@interface QCloudAccessControlList : NSObject
/**
存放被授权者信息的数组
*/
@property (strong, nonatomic) NSArray<QCloudACLGrant*> *ACLGrants;
@end
NS_ASSUME_NONNULL_END
88 changes: 88 additions & 0 deletions QCloudCOSXML/Classes/Manager/QCloudAccessControlList.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
//
// QCloudAccessControlList.m
// QCloudAccessControlList
//
// Created by tencent
// Copyright (c) 2015年 tencent. All rights reserved.
//
// ██████╗ ██████╗██╗ ██████╗ ██╗ ██╗██████╗ ████████╗███████╗██████╗ ███╗ ███╗██╗███╗ ██╗ █████╗ ██╗ ██╗ █████╗ ██████╗
// ██╔═══██╗██╔════╝██║ ██╔═══██╗██║ ██║██╔══██╗ ╚══██╔══╝██╔════╝██╔══██╗████╗ ████║██║████╗ ██║██╔══██╗██║ ██║ ██╔══██╗██╔══██╗
// ██║ ██║██║ ██║ ██║ ██║██║ ██║██║ ██║ ██║ █████╗ ██████╔╝██╔████╔██║██║██╔██╗ ██║███████║██║ ██║ ███████║██████╔╝
// ██║▄▄ ██║██║ ██║ ██║ ██║██║ ██║██║ ██║ ██║ ██╔══╝ ██╔══██╗██║╚██╔╝██║██║██║╚██╗██║██╔══██║██║ ██║ ██╔══██║██╔══██╗
// ╚██████╔╝╚██████╗███████╗╚██████╔╝╚██████╔╝██████╔╝ ██║ ███████╗██║ ██║██║ ╚═╝ ██║██║██║ ╚████║██║ ██║███████╗ ███████╗██║ ██║██████╔╝
// ╚══▀▀═╝ ╚═════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝ ╚══════╝╚═╝ ╚═╝╚═════╝
//
//
// _ __ _ _
// (_) / _| | | | |
// ___ ___ _ ____ ___ ___ ___ | |_ ___ _ __ __| | _____ _____| | ___ _ __ ___ _ __ ___
// / __|/ _ \ '__\ \ / / |/ __/ _ \ | _/ _ \| '__| / _` |/ _ \ \ / / _ \ |/ _ \| '_ \ / _ \ '__/ __|
// \__ \ __/ | \ V /| | (_| __/ | || (_) | | | (_| | __/\ V / __/ | (_) | |_) | __/ | \__
// |___/\___|_| \_/ |_|\___\___| |_| \___/|_| \__,_|\___| \_/ \___|_|\___/| .__/ \___|_| |___/
// ______ ______ ______ ______ ______ ______ ______ ______ | |
// |______|______|______|______|______|______|______|______| |_|
//


#import "QCloudAccessControlList.h"

#import "QCloudACLGrant.h"

@class QCloudACLGrant;

NS_ASSUME_NONNULL_BEGIN
@implementation QCloudAccessControlList

+ (NSDictionary *)modelContainerPropertyGenericClass
{
return @ {
@"ACLGrants":[QCloudACLGrant class],
};
}


+ (NSDictionary *)modelCustomPropertyMapper
{
return @{
@"ACLGrants" :@"Grant",
};
}


- (BOOL)modelCustomTransformToDictionary:(NSMutableDictionary *)dic
{


return YES;
}

- (NSDictionary *)modelCustomWillTransformFromDictionary:(NSDictionary *)dic
{
if (!dic) {
return dic;
}
NSMutableDictionary* transfromDic = [NSMutableDictionary dictionaryWithDictionary:dic];
NSArray* transformArrayKeypaths = @[
@"Grant",
];

for (NSString* keyPath in transformArrayKeypaths) {
id object = [dic valueForKeyPath:keyPath];
if (!object) {
continue;
}
if ([object isKindOfClass:[NSNull class]]) {
continue;
}
if (![object isKindOfClass:[NSArray class]]) {
[transfromDic setValue:@[object] forKeyPath:keyPath];
}
}

return transfromDic;
}

@end


NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,7 @@ - (NSDictionary *)modelCustomWillTransformFromDictionary:(NSDictionary *)dic
continue;
}
if (![object isKindOfClass:[NSArray class]]) {
if ([object isKindOfClass:[NSDictionary class]] && [(NSDictionary*)object count] == 1) {
id value = [[object allValues] firstObject];
if ([value isKindOfClass:[NSArray class]]) {
[transfromDic setValue:value forKey:keyPath];
} else {
[transfromDic setValue:@[value] forKey:keyPath];
}
} else {
[transfromDic setValue:@[object] forKeyPath:keyPath];
}
[transfromDic setValue:@[object] forKeyPath:keyPath];
}
}

Expand Down
11 changes: 1 addition & 10 deletions QCloudCOSXML/Classes/Manager/QCloudCORSConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,7 @@ - (NSDictionary *)modelCustomWillTransformFromDictionary:(NSDictionary *)dic
continue;
}
if (![object isKindOfClass:[NSArray class]]) {
if ([object isKindOfClass:[NSDictionary class]] && [(NSDictionary*)object count] == 1) {
id value = [[object allValues] firstObject];
if ([value isKindOfClass:[NSArray class]]) {
[transfromDic setValue:value forKey:keyPath];
} else {
[transfromDic setValue:@[value] forKey:keyPath];
}
} else {
[transfromDic setValue:@[object] forKeyPath:keyPath];
}
[transfromDic setValue:@[object] forKeyPath:keyPath];
}
}

Expand Down
11 changes: 1 addition & 10 deletions QCloudCOSXML/Classes/Manager/QCloudCORSRule.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,7 @@ - (NSDictionary *)modelCustomWillTransformFromDictionary:(NSDictionary *)dic
continue;
}
if (![object isKindOfClass:[NSArray class]]) {
if ([object isKindOfClass:[NSDictionary class]] && [(NSDictionary*)object count] == 1) {
id value = [[object allValues] firstObject];
if ([value isKindOfClass:[NSArray class]]) {
[transfromDic setValue:value forKey:keyPath];
} else {
[transfromDic setValue:@[value] forKey:keyPath];
}
} else {
[transfromDic setValue:@[object] forKeyPath:keyPath];
}
[transfromDic setValue:@[object] forKeyPath:keyPath];
}
}

Expand Down
11 changes: 1 addition & 10 deletions QCloudCOSXML/Classes/Manager/QCloudDeleteInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,7 @@ - (NSDictionary *)modelCustomWillTransformFromDictionary:(NSDictionary *)dic
continue;
}
if (![object isKindOfClass:[NSArray class]]) {
if ([object isKindOfClass:[NSDictionary class]] && [(NSDictionary*)object count] == 1) {
id value = [[object allValues] firstObject];
if ([value isKindOfClass:[NSArray class]]) {
[transfromDic setValue:value forKey:keyPath];
} else {
[transfromDic setValue:@[value] forKey:keyPath];
}
} else {
[transfromDic setValue:@[object] forKeyPath:keyPath];
}
[transfromDic setValue:@[object] forKeyPath:keyPath];
}
}

Expand Down
11 changes: 1 addition & 10 deletions QCloudCOSXML/Classes/Manager/QCloudDeleteResult.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,7 @@ - (NSDictionary *)modelCustomWillTransformFromDictionary:(NSDictionary *)dic
continue;
}
if (![object isKindOfClass:[NSArray class]]) {
if ([object isKindOfClass:[NSDictionary class]] && [(NSDictionary*)object count] == 1) {
id value = [[object allValues] firstObject];
if ([value isKindOfClass:[NSArray class]]) {
[transfromDic setValue:value forKey:keyPath];
} else {
[transfromDic setValue:@[value] forKey:keyPath];
}
} else {
[transfromDic setValue:@[object] forKeyPath:keyPath];
}
[transfromDic setValue:@[object] forKeyPath:keyPath];
}
}

Expand Down
11 changes: 1 addition & 10 deletions QCloudCOSXML/Classes/Manager/QCloudLifecycleConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,7 @@ - (NSDictionary *)modelCustomWillTransformFromDictionary:(NSDictionary *)dic
continue;
}
if (![object isKindOfClass:[NSArray class]]) {
if ([object isKindOfClass:[NSDictionary class]] && [(NSDictionary*)object count] == 1) {
id value = [[object allValues] firstObject];
if ([value isKindOfClass:[NSArray class]]) {
[transfromDic setValue:value forKey:keyPath];
} else {
[transfromDic setValue:@[value] forKey:keyPath];
}
} else {
[transfromDic setValue:@[object] forKeyPath:keyPath];
}
[transfromDic setValue:@[object] forKeyPath:keyPath];
}
}

Expand Down
Loading

0 comments on commit c39d602

Please sign in to comment.