Skip to content

Commit 9c74253

Browse files
author
garenwang
committed
修改DEBUG编译报错
1 parent 2d7643c commit 9c74253

File tree

4 files changed

+31
-49
lines changed

4 files changed

+31
-49
lines changed

QCloudCOSXML/Classes/Base/QCloudCOSXMLEndPoint.m

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,9 @@ - (NSString *)formattedBucket:(NSString *)bucket withAPPID:(NSString *)APPID {
4242
}
4343
} else {
4444
if (!APPID) {
45-
if (DEBUG) {
46-
@throw [NSException exceptionWithName:kQCloudNetworkDomain
47-
reason:[NSString stringWithFormat:@"您没有配置AppID就使用了服务%@", self.class]
48-
userInfo:nil];
49-
}
45+
@throw [NSException exceptionWithName:kQCloudNetworkDomain
46+
reason:[NSString stringWithFormat:@"您没有配置AppID就使用了服务%@", self.class]
47+
userInfo:nil];
5048
}
5149
}
5250

QCloudCOSXML/Classes/Base/QCloudCOSXMLService.m

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ @implementation QCloudCOSXMLService
5050
+ (QCloudCOSXMLService *)defaultCOSXML {
5151
@synchronized(self) {
5252
if (!COSXMLService) {
53-
if (DEBUG) {
54-
@throw [NSException exceptionWithName:QCloudErrorDomain reason:@"您没有配置默认的OCR服务配置,请配置之后再调用该方法" userInfo:nil];
55-
}
53+
@throw [NSException exceptionWithName:QCloudErrorDomain reason:@"您没有配置默认的OCR服务配置,请配置之后再调用该方法" userInfo:nil];
5654
}
5755
return COSXMLService;
5856
}
@@ -61,13 +59,11 @@ + (QCloudCOSXMLService *)defaultCOSXML {
6159
+ (QCloudCOSXMLService *)registerDefaultCOSXMLWithConfiguration:(QCloudServiceConfiguration *)configuration {
6260
@synchronized(self) {
6361
if (COSXMLService) {
64-
if (DEBUG) {
65-
@throw [NSException
66-
exceptionWithName:QCloudErrorDomain
67-
reason:[NSString stringWithFormat:
68-
@"默认的COSXMLService已存在,如有新的配置,请通过 registerCOSXMLWithConfiguration:withKey:重新注册"]
69-
userInfo:nil];
70-
}
62+
@throw [NSException
63+
exceptionWithName:QCloudErrorDomain
64+
reason:[NSString stringWithFormat:
65+
@"默认的COSXMLService已存在,如有新的配置,请通过 registerCOSXMLWithConfiguration:withKey:重新注册"]
66+
userInfo:nil];
7167
}
7268
COSXMLService = [[QCloudCOSXMLService alloc] initWithConfiguration:configuration];
7369
if (!configuration.isCloseShareLog) {
@@ -82,11 +78,9 @@ + (QCloudCOSXMLService *)registerDefaultCOSXMLWithConfiguration:(QCloudServiceCo
8278
+ (QCloudCOSXMLService *)cosxmlServiceForKey:(NSString *)key {
8379
QCloudCOSXMLService *cosxmlService = [QCloudCOSXMLServiceCache() objectForKey:key];
8480
if (!cosxmlService) {
85-
if (DEBUG) {
86-
@throw [NSException exceptionWithName:QCloudErrorDomain
87-
reason:[NSString stringWithFormat:@"您没有配置Key为%@的OCR服务配置,请配置之后再调用该方法", key]
88-
userInfo:nil];
89-
}
81+
@throw [NSException exceptionWithName:QCloudErrorDomain
82+
reason:[NSString stringWithFormat:@"您没有配置Key为%@的OCR服务配置,请配置之后再调用该方法", key]
83+
userInfo:nil];
9084
}
9185
return cosxmlService;
9286
}
@@ -98,14 +92,12 @@ + (void)removeCOSXMLWithKey:(NSString *)key {
9892
+ (QCloudCOSXMLService *)registerCOSXMLWithConfiguration:(QCloudServiceConfiguration *)configuration withKey:(NSString *)key;
9993
{
10094
if ([self hasServiceForKey:key]) {
101-
if (DEBUG) {
102-
@throw [NSException
103-
exceptionWithName:QCloudErrorDomain
104-
reason:[NSString
105-
stringWithFormat:
106-
@"key: %@ COSXMLService已存在,如有新的配置,请通过 registerCOSXMLWithConfiguration:withKey:重新注册", key]
107-
userInfo:nil];
108-
}
95+
@throw [NSException
96+
exceptionWithName:QCloudErrorDomain
97+
reason:[NSString
98+
stringWithFormat:
99+
@"key: %@ COSXMLService已存在,如有新的配置,请通过 registerCOSXMLWithConfiguration:withKey:重新注册", key]
100+
userInfo:nil];
109101
}
110102
QCloudCOSXMLService *cosxmlService = [[QCloudCOSXMLService alloc] initWithConfiguration:configuration];
111103
[QCloudCOSXMLServiceCache() setObject:cosxmlService forKey:key];

QCloudCOSXML/Classes/Transfer/QCloudCOSTransferMangerService.m

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@ @implementation QCloudCOSTransferMangerService
6262
+ (QCloudCOSTransferMangerService *)defaultCOSTransferManager {
6363
@synchronized(self) {
6464
if (!COSTransferMangerService) {
65-
if (DEBUG) {
66-
@throw [NSException exceptionWithName:QCloudErrorDomain reason:@"您没有配置默认的OCR服务配置,请配置之后再调用该方法" userInfo:nil];
67-
}
65+
@throw [NSException exceptionWithName:QCloudErrorDomain reason:@"您没有配置默认的OCR服务配置,请配置之后再调用该方法" userInfo:nil];
6866
}
6967
return COSTransferMangerService;
7068
}
@@ -80,11 +78,9 @@ + (QCloudCOSTransferMangerService *)registerDefaultCOSTransferMangerWithConfigur
8078
+ (QCloudCOSTransferMangerService *)costransfermangerServiceForKey:(NSString *)key {
8179
QCloudCOSTransferMangerService *costransfermangerService = [QCloudCOSTransferMangerServiceCache() objectForKey:key];
8280
if (!costransfermangerService) {
83-
if (DEBUG) {
84-
@throw [NSException exceptionWithName:QCloudErrorDomain
85-
reason:[NSString stringWithFormat:@"您没有配置Key为%@的OCR服务配置,请配置之后再调用该方法", key]
86-
userInfo:nil];
87-
}
81+
@throw [NSException exceptionWithName:QCloudErrorDomain
82+
reason:[NSString stringWithFormat:@"您没有配置Key为%@的OCR服务配置,请配置之后再调用该方法", key]
83+
userInfo:nil];
8884
}
8985
return costransfermangerService;
9086
}

QCloudCOSXML/Classes/Transfer/request/QCloudCOSXMLUploadObjectRequest.m

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,12 @@ - (void)fakeStart {
251251
}
252252
self.dataContentLength = QCloudFileSize(url.path);
253253
if(_mutilThreshold<kQCloudCOSXMLUploadLengthLimit){
254-
if (DEBUG) {
255-
@throw [NSException
256-
exceptionWithName:QCloudErrorDomain
257-
reason:[NSString
258-
stringWithFormat:
259-
@"分块接口的阈值不能小于 1MB ,当前阈值为 %ld", (long)_mutilThreshold]
260-
userInfo:nil];
261-
}
254+
@throw [NSException
255+
exceptionWithName:QCloudErrorDomain
256+
reason:[NSString
257+
stringWithFormat:
258+
@"分块接口的阈值不能小于 1MB ,当前阈值为 %ld", (long)_mutilThreshold]
259+
userInfo:nil];
262260
}
263261
if (self.dataContentLength > _mutilThreshold) {
264262
//开始分片上传的时候,上传的起始位置是0
@@ -269,11 +267,9 @@ - (void)fakeStart {
269267
[self startSimpleUpload];
270268
}
271269
} else {
272-
if (DEBUG) {
273-
@throw [NSException exceptionWithName:QCloudErrorDomain
274-
reason:@"不支持设置该类型的body,支持的类型为NSData、QCloudFileOffsetBody"
275-
userInfo:@{}];
276-
}
270+
@throw [NSException exceptionWithName:QCloudErrorDomain
271+
reason:@"不支持设置该类型的body,支持的类型为NSData、QCloudFileOffsetBody"
272+
userInfo:@{}];
277273
}
278274
}
279275
- (void)startSimpleUpload {

0 commit comments

Comments
 (0)