Skip to content

Commit c14cbc3

Browse files
author
erichmzhang
committed
# 5.5.0
- 增加了后台上传的功能,当 APP 切到后台时,仍然可以继续上传。 - EndPoint中可以使用自定义的 ServerURL, 如加速上传域名等。
1 parent 2d7b251 commit c14cbc3

File tree

256 files changed

+573
-1761
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

256 files changed

+573
-1761
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions

QCloudCOSXML.podspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "QCloudCOSXML"
3-
s.version = "5.4.7"
3+
s.version = "5.5.0"
44
s.summary = "QCloudCOSXML 腾讯云iOS-SDK组件"
55

66
s.homepage = "https://cloud.tencent.com/"
@@ -9,12 +9,12 @@ s.version = "5.4.7"
99
s.source = { :git => "https://github.com/tencentyun/qcloud-sdk-ios.git", :tag => s.version.to_s }
1010
s.ios.deployment_target = '8.0'
1111
s.source_files = 'QCloudCOSXML/Classes/**/*'
12-
s.dependency "QCloudCore",'5.4.7'
12+
s.dependency "QCloudCore",'5.5.0'
1313
s.static_framework = true
1414

1515
s.subspec 'Transfer' do |sbt|
16-
sbt.source_files = 'QCloudCOSXML/Classes/Transfer/*','QCloudCOSXML/Classes/Base/*'
17-
sbt.dependency "QCloudCore",'5.4.7'
16+
sbt.source_files = 'QCloudCOSXML/Classes/Transfer/**/*','QCloudCOSXML/Classes/Base/*'
17+
sbt.dependency "QCloudCore",'5.5.0'
1818
# sbt.static_framework=true
1919
end
2020
end

QCloudCOSXML/Classes/Base/QCloudCOSXMLEndPoint.m

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,7 @@ - (instancetype) init
2020
return self;
2121
}
2222

23-
- (NSString*)formattedRegionName:(NSString*)regionName {
24-
NSArray* oldRegionNameArray = @[@"cn-east",@"cn-south",@"cn-south-2",@"cn-north",@"cn-southwest",@"sg"];
25-
BOOL isOldRegion = NO;
26-
for (NSString* oldRegionName in oldRegionNameArray) {
27-
if ([regionName isEqualToString:oldRegionName]) {
28-
isOldRegion = YES;
29-
break;
30-
}
31-
}
32-
if (isOldRegion) {
33-
return regionName;
34-
} else {
35-
return [NSString stringWithFormat:@"cos.%@",self.regionName];
36-
}
37-
}
23+
3824

3925
- (NSString *)formattedBucket:(NSString*)bucket withAPPID:(NSString*)APPID {
4026
NSInteger subfixLength = APPID.length + 1;
@@ -52,6 +38,10 @@ - (NSString *)formattedBucket:(NSString*)bucket withAPPID:(NSString*)APPID {
5238

5339
- (NSURL*) serverURLWithBucket:(NSString *)bucket appID:(NSString *)appID
5440
{
41+
if (self.serverURLLiteral) {
42+
return self.serverURLLiteral;
43+
}
44+
5545
NSString* scheme = @"https";
5646
if (!self.useHTTPS) {
5747
scheme = @"http";
@@ -63,10 +53,9 @@ - (NSURL*) serverURLWithBucket:(NSString *)bucket appID:(NSString *)appID
6353
QCloudLogDebug(@"bucket %@ contains illeagal character, building service url pregress returns immediately", bucket);
6454
return nil;
6555
}
66-
67-
NSString* formattedRegionName = [self formattedRegionName:self.regionName];
56+
6857
NSString* formattedBucketName = [self formattedBucket:bucket withAPPID:appID];
69-
NSURL* serverURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://%@-%@.%@.%@",scheme,formattedBucketName,appID,formattedRegionName,self.serviceName]];
58+
NSURL* serverURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://%@-%@.cos.%@.%@",scheme,formattedBucketName,appID,self.regionName,self.serviceName]];
7059
return serverURL;
7160
}
7261

QCloudCOSXML/Classes/Base/QCloudCOSXMLService.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,18 @@
2828

2929
#import <Foundation/Foundation.h>
3030
#import <QCloudCore/QCloudService.h>
31+
#import <QCloudCore/QCloudCore.h>
3132

32-
@interface QCloudCOSXMLService : QCloudService
3333

34+
@interface QCloudCOSXMLService : QCloudService
3435
#pragma hidden super selectors
3536
- (int) performRequest:(QCloudBizHTTPRequest *)httpRequst NS_UNAVAILABLE;
3637
- (int) performRequest:(QCloudBizHTTPRequest *)httpRequst withFinishBlock:(QCloudRequestFinishBlock)block NS_UNAVAILABLE;
3738

3839
#pragma Factory
3940
+ (QCloudCOSXMLService*) defaultCOSXML;
4041
+ (QCloudCOSXMLService*) cosxmlServiceForKey:(NSString*)key;
41-
42+
#pragma hidden super selectors
4243
/**
4344
检查是否存在key对应的service
4445
@@ -66,5 +67,4 @@
6667
*/
6768
- (NSString*)getURLWithBucket:(NSString*)bucket object:(NSString*)object withAuthorization:(BOOL)withAuthorization;
6869

69-
7070
@end

QCloudCOSXML/Classes/Base/QCloudCOSXMLService.m

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#import "QCloudCOSXMLService+Private.h"
3030
#import <QCloudCore/QCloudThreadSafeMutableDictionary.h>
3131
#import <QCloudCore/QCLoudError.h>
32-
32+
#import "UIDevice+FCUUID.h"
3333
QCloudThreadSafeMutableDictionary* QCloudCOSXMLServiceCache()
3434
{
3535
static QCloudThreadSafeMutableDictionary* CloudcosxmlService = nil;
@@ -39,8 +39,8 @@
3939
});
4040
return CloudcosxmlService;
4141
}
42-
4342
@implementation QCloudCOSXMLService
43+
@synthesize sessionManager = _sessionManager;
4444
static QCloudCOSXMLService* COSXMLService = nil;
4545

4646

@@ -53,6 +53,25 @@ + (QCloudCOSXMLService*) defaultCOSXML
5353
return COSXMLService;
5454
}
5555
}
56+
- (QCloudHTTPSessionManager*) sessionManager {
57+
58+
@synchronized(self) {
59+
if (self.configuration.backgroundEnable) {
60+
if (self.configuration.backgroundIn4GEnable) {
61+
return [QCloudHTTPSessionManager sessionManagerWithBackgroundIdentifier:self.configuration.backgroundIdentifier];
62+
}else{
63+
if (([QCloudNetEnv shareEnv].currentNetStatus == QCloudReachableViaWiFi)) {
64+
return [QCloudHTTPSessionManager sessionManagerWithBackgroundIdentifier:self.configuration.backgroundIdentifier];
65+
}else{
66+
return [QCloudHTTPSessionManager shareClient];
67+
}
68+
}
69+
70+
}
71+
}
72+
73+
return [QCloudHTTPSessionManager shareClient];
74+
}
5675

5776
+ (QCloudCOSXMLService*) registerDefaultCOSXMLWithConfiguration:(QCloudServiceConfiguration*)configuration
5877
{
@@ -112,5 +131,4 @@ + (BOOL)hasServiceForKey:(NSString *)key {
112131
}
113132
}
114133

115-
116134
@end

0 commit comments

Comments
 (0)