Skip to content

Commit 32f8709

Browse files
authored
iOS support min version to 9.0 (#435)
1 parent 3db00f9 commit 32f8709

File tree

12 files changed

+55
-102
lines changed

12 files changed

+55
-102
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
#Changelog
2+
## 8.7.0(2023-10-23)
3+
- iOS 最低版本调整至 iOS9
4+
- QNFixedZone 新增通过 RegionID 构造实例的方法
5+
- 区域查询结果缓存支持磁盘缓存
6+
27
## 8.6.0(2023-08-07)
38
- 调整在根据 Bucket 获取其所在区域信息时的主备域名顺序
49
- 移除亚太-首尔区域

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import PackageDescription
66
let package = Package(
77
name: "Qiniu",
88
platforms: [
9-
.macOS(.v10_10),
10-
.iOS(.v8)
9+
.macOS(.v10_15),
10+
.iOS(.v9)
1111
],
1212
products: [
1313
// Products define the executables and libraries a package produces, and make them visible to other packages.

Podfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ def test_dependencies
1010
end
1111

1212
target 'QiniuSDK_iOS' do
13-
platform :ios, '7.0'
13+
platform :ios, '9.0'
1414
shared_dependencies
1515
end
1616

1717
target 'QiniuSDK_iOSTests' do
18-
platform :ios, '7.0'
18+
platform :ios, '9.0'
1919
shared_dependencies
2020
test_dependencies
2121
end
2222

2323
target 'QiniuSDK_Mac' do
24-
platform :osx, '10.9'
24+
platform :osx, '10.15'
2525
shared_dependencies
2626
end
2727

2828
target 'QiniuSDK_MacTests' do
29-
platform :osx, '10.9'
29+
platform :osx, '10.15'
3030
shared_dependencies
3131
test_dependencies
3232
end

Qiniu.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
Pod::Spec.new do |s|
22
s.name = 'Qiniu'
3-
s.version = '8.6.0'
3+
s.version = '8.7.0'
44
s.summary = 'Qiniu Resource Storage SDK for iOS and Mac'
55
s.homepage = 'https://github.com/qiniu/objc-sdk'
66
s.social_media_url = 'http://weibo.com/qiniutek'
77
s.author = "Qiniu => [email protected]"
88
s.source = {:git => 'https://github.com/qiniu/objc-sdk.git', :tag => "v#{s.version}"}
99

10-
s.ios.deployment_target = '7.0'
11-
s.osx.deployment_target = '10.9'
10+
s.ios.deployment_target = '9.0'
11+
s.osx.deployment_target = '10.15'
1212

1313
s.source_files = 'QiniuSDK/BigData/**/*.{h,m}','QiniuSDK/Collect/**/*.{h,m}','QiniuSDK/Common/**/*.{h,m}','QiniuSDK/Http/**/*.{h,m}','QiniuSDK/Recorder/**/*.{h,m}','QiniuSDK/Storage/**/*.{h,m}','QiniuSDK/Transaction/**/*.{h,m}','QiniuSDK/Utils/**/*.{h,m}','QiniuSDK/QiniuSDK.h'
1414
s.requires_arc = true

QiniuSDK.xcodeproj/project.pbxproj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1854,8 +1854,8 @@
18541854
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
18551855
GCC_WARN_UNUSED_FUNCTION = YES;
18561856
GCC_WARN_UNUSED_VARIABLE = YES;
1857-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
1858-
MACOSX_DEPLOYMENT_TARGET = 10.14;
1857+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
1858+
MACOSX_DEPLOYMENT_TARGET = 10.15;
18591859
MTL_ENABLE_DEBUG_INFO = YES;
18601860
ONLY_ACTIVE_ARCH = YES;
18611861
OTHER_LDFLAGS = "$(inherited)";
@@ -1903,8 +1903,8 @@
19031903
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
19041904
GCC_WARN_UNUSED_FUNCTION = YES;
19051905
GCC_WARN_UNUSED_VARIABLE = YES;
1906-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
1907-
MACOSX_DEPLOYMENT_TARGET = 10.14;
1906+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
1907+
MACOSX_DEPLOYMENT_TARGET = 10.15;
19081908
MTL_ENABLE_DEBUG_INFO = NO;
19091909
OTHER_LDFLAGS = "$(inherited)";
19101910
SDKROOT = macosx;
@@ -2020,6 +2020,7 @@
20202020
GCC_OPTIMIZATION_LEVEL = 0;
20212021
GENERATE_INFOPLIST_FILE = YES;
20222022
GENERATE_PKGINFO_FILE = YES;
2023+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
20232024
PRODUCT_NAME = QiniuSDK_iOSTests;
20242025
PROVISIONING_PROFILE_SPECIFIER = "";
20252026
SDKROOT = iphoneos;
@@ -2038,6 +2039,7 @@
20382039
DEVELOPMENT_TEAM = "";
20392040
GENERATE_INFOPLIST_FILE = YES;
20402041
GENERATE_PKGINFO_FILE = YES;
2042+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
20412043
PRODUCT_NAME = QiniuSDK_iOSTests;
20422044
PROVISIONING_PROFILE_SPECIFIER = "";
20432045
SDKROOT = iphoneos;

QiniuSDK/Storage/QNUploadManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ typedef void (^QNUpCompletionHandler)(QNResponseInfo *info, NSString *key, NSDic
145145
key:(NSString *)key
146146
token:(NSString *)token
147147
complete:(QNUpCompletionHandler)completionHandler
148-
option:(QNUploadOption *)option API_UNAVAILABLE(macos, tvos);
148+
option:(QNUploadOption *)option API_DEPRECATED("use putPHAsset instead", ios(4.0, 9.0)) API_UNAVAILABLE(macos, tvos);
149149
#endif
150150

151151
/**

QiniuSDK/Utils/QNALAssetFile.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED)
1414
#if !TARGET_OS_MACCATALYST
1515
@class ALAsset;
16-
@interface QNALAssetFile : NSObject <QNFileDelegate>
16+
@interface QNALAssetFile : NSObject <QNFileDelegate>;
1717

1818
/**
1919
* 打开指定文件
@@ -24,7 +24,7 @@
2424
* @return 实例
2525
*/
2626
- (instancetype)init:(ALAsset *)asset
27-
error:(NSError *__autoreleasing *)error;
27+
error:(NSError *__autoreleasing *)error NS_DEPRECATED_IOS(4_0, 9_0);
2828
@end
2929
#endif
3030
#endif

QiniuSDK/Utils/QNALAssetFile.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
@interface QNALAssetFile ()
1717

18-
@property (nonatomic) ALAsset *asset;
18+
@property (nonatomic) ALAsset *asset NS_DEPRECATED_IOS(4_0, 9_0);
1919

2020
@property (readonly) int64_t fileSize;
2121

@@ -45,7 +45,7 @@ - (instancetype)init:(ALAsset *)asset
4545

4646
- (NSData *)read:(long long)offset
4747
size:(long)size
48-
error:(NSError **)error {
48+
error:(NSError **)error NS_DEPRECATED_IOS(4_0, 9_0) {
4949

5050
NSData *data = nil;
5151
@try {
@@ -70,7 +70,7 @@ - (NSData *)readAllWithError:(NSError **)error {
7070
- (void)close {
7171
}
7272

73-
- (NSString *)path {
73+
- (NSString *)path NS_DEPRECATED_IOS(4_0, 9_0) {
7474
ALAssetRepresentation *rep = [self.asset defaultRepresentation];
7575
return [rep url].path;
7676
}

QiniuSDK/Utils/QNMutableArray.m

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ - (NSData *)sortedArrayHint {
134134
LOCK(NSData * d = [_arr sortedArrayHint]); return d;
135135
}
136136

137-
- (NSArray *)sortedArrayUsingFunction:(NSInteger (*)(id, id, void *))comparator context:(void *)context {
137+
- (NSArray *)sortedArrayUsingFunction:(NSInteger (NS_NOESCAPE *)(id, id, void *))comparator context:(void *)context {
138138
LOCK(NSArray * arr = [_arr sortedArrayUsingFunction:comparator context:context]) return arr;
139139
}
140140

141-
- (NSArray *)sortedArrayUsingFunction:(NSInteger (*)(id, id, void *))comparator context:(void *)context hint:(NSData *)hint {
141+
- (NSArray *)sortedArrayUsingFunction:(NSInteger (NS_NOESCAPE *)(id, id, void *))comparator context:(void *)context hint:(NSData *)hint {
142142
LOCK(NSArray * arr = [_arr sortedArrayUsingFunction:comparator context:context hint:hint]); return arr;
143143
}
144144

@@ -166,51 +166,51 @@ - (id)objectAtIndexedSubscript:(NSUInteger)idx {
166166
LOCK(id o = [_arr objectAtIndexedSubscript:idx]); return o;
167167
}
168168

169-
- (void)enumerateObjectsUsingBlock:(void (^)(id obj, NSUInteger idx, BOOL *stop))block {
169+
- (void)enumerateObjectsUsingBlock:(void (NS_NOESCAPE ^)(id obj, NSUInteger idx, BOOL *stop))block {
170170
LOCK([_arr enumerateObjectsUsingBlock:block]);
171171
}
172172

173-
- (void)enumerateObjectsWithOptions:(NSEnumerationOptions)opts usingBlock:(void (^)(id obj, NSUInteger idx, BOOL *stop))block {
173+
- (void)enumerateObjectsWithOptions:(NSEnumerationOptions)opts usingBlock:(void (NS_NOESCAPE ^)(id obj, NSUInteger idx, BOOL *stop))block {
174174
LOCK([_arr enumerateObjectsWithOptions:opts usingBlock:block]);
175175
}
176176

177-
- (void)enumerateObjectsAtIndexes:(NSIndexSet *)s options:(NSEnumerationOptions)opts usingBlock:(void (^)(id obj, NSUInteger idx, BOOL *stop))block {
177+
- (void)enumerateObjectsAtIndexes:(NSIndexSet *)s options:(NSEnumerationOptions)opts usingBlock:(void (NS_NOESCAPE ^)(id obj, NSUInteger idx, BOOL *stop))block {
178178
LOCK([_arr enumerateObjectsAtIndexes:s options:opts usingBlock:block]);
179179
}
180180

181-
- (NSUInteger)indexOfObjectPassingTest:(BOOL (^)(id obj, NSUInteger idx, BOOL *stop))predicate {
181+
- (NSUInteger)indexOfObjectPassingTest:(BOOL (NS_NOESCAPE ^)(id obj, NSUInteger idx, BOOL *stop))predicate {
182182
LOCK(NSUInteger i = [_arr indexOfObjectPassingTest:predicate]); return i;
183183
}
184184

185-
- (NSUInteger)indexOfObjectWithOptions:(NSEnumerationOptions)opts passingTest:(BOOL (^)(id obj, NSUInteger idx, BOOL *stop))predicate {
185+
- (NSUInteger)indexOfObjectWithOptions:(NSEnumerationOptions)opts passingTest:(BOOL (NS_NOESCAPE ^)(id obj, NSUInteger idx, BOOL *stop))predicate {
186186
LOCK(NSUInteger i = [_arr indexOfObjectWithOptions:opts passingTest:predicate]); return i;
187187
}
188188

189-
- (NSUInteger)indexOfObjectAtIndexes:(NSIndexSet *)s options:(NSEnumerationOptions)opts passingTest:(BOOL (^)(id obj, NSUInteger idx, BOOL *stop))predicate {
189+
- (NSUInteger)indexOfObjectAtIndexes:(NSIndexSet *)s options:(NSEnumerationOptions)opts passingTest:(BOOL (NS_NOESCAPE ^)(id obj, NSUInteger idx, BOOL *stop))predicate {
190190
LOCK(NSUInteger i = [_arr indexOfObjectAtIndexes:s options:opts passingTest:predicate]); return i;
191191
}
192192

193-
- (NSIndexSet *)indexesOfObjectsPassingTest:(BOOL (^)(id obj, NSUInteger idx, BOOL *stop))predicate {
193+
- (NSIndexSet *)indexesOfObjectsPassingTest:(BOOL (NS_NOESCAPE ^)(id obj, NSUInteger idx, BOOL *stop))predicate {
194194
LOCK(NSIndexSet * i = [_arr indexesOfObjectsPassingTest:predicate]); return i;
195195
}
196196

197-
- (NSIndexSet *)indexesOfObjectsWithOptions:(NSEnumerationOptions)opts passingTest:(BOOL (^)(id obj, NSUInteger idx, BOOL *stop))predicate {
197+
- (NSIndexSet *)indexesOfObjectsWithOptions:(NSEnumerationOptions)opts passingTest:(BOOL (NS_NOESCAPE ^)(id obj, NSUInteger idx, BOOL *stop))predicate {
198198
LOCK(NSIndexSet * i = [_arr indexesOfObjectsWithOptions:opts passingTest:predicate]); return i;
199199
}
200200

201-
- (NSIndexSet *)indexesOfObjectsAtIndexes:(NSIndexSet *)s options:(NSEnumerationOptions)opts passingTest:(BOOL (^)(id obj, NSUInteger idx, BOOL *stop))predicate {
201+
- (NSIndexSet *)indexesOfObjectsAtIndexes:(NSIndexSet *)s options:(NSEnumerationOptions)opts passingTest:(BOOL (NS_NOESCAPE ^)(id obj, NSUInteger idx, BOOL *stop))predicate {
202202
LOCK(NSIndexSet * i = [_arr indexesOfObjectsAtIndexes:s options:opts passingTest:predicate]); return i;
203203
}
204204

205-
- (NSArray *)sortedArrayUsingComparator:(NSComparator)cmptr {
205+
- (NSArray *)sortedArrayUsingComparator:(NSComparator NS_NOESCAPE)cmptr {
206206
LOCK(NSArray * a = [_arr sortedArrayUsingComparator:cmptr]); return a;
207207
}
208208

209-
- (NSArray *)sortedArrayWithOptions:(NSSortOptions)opts usingComparator:(NSComparator)cmptr {
209+
- (NSArray *)sortedArrayWithOptions:(NSSortOptions)opts usingComparator:(NSComparator NS_NOESCAPE)cmptr {
210210
LOCK(NSArray * a = [_arr sortedArrayWithOptions:opts usingComparator:cmptr]); return a;
211211
}
212212

213-
- (NSUInteger)indexOfObject:(id)obj inSortedRange:(NSRange)r options:(NSBinarySearchingOptions)opts usingComparator:(NSComparator)cmp {
213+
- (NSUInteger)indexOfObject:(id)obj inSortedRange:(NSRange)r options:(NSBinarySearchingOptions)opts usingComparator:(NSComparator NS_NOESCAPE)cmp {
214214
LOCK(NSUInteger i = [_arr indexOfObject:obj inSortedRange:r options:opts usingComparator:cmp]); return i;
215215
}
216216

@@ -284,7 +284,7 @@ - (void)setArray:(NSArray *)otherArray {
284284
LOCK([_arr setArray:otherArray]);
285285
}
286286

287-
- (void)sortUsingFunction:(NSInteger (*)(id, id, void *))compare context:(void *)context {
287+
- (void)sortUsingFunction:(NSInteger (NS_NOESCAPE *)(id, id, void *))compare context:(void *)context {
288288
LOCK([_arr sortUsingFunction:compare context:context]);
289289
}
290290

@@ -308,11 +308,11 @@ - (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)idx {
308308
LOCK([_arr setObject:obj atIndexedSubscript:idx]);
309309
}
310310

311-
- (void)sortUsingComparator:(NSComparator)cmptr {
311+
- (void)sortUsingComparator:(NSComparator NS_NOESCAPE)cmptr {
312312
LOCK([_arr sortUsingComparator:cmptr]);
313313
}
314314

315-
- (void)sortWithOptions:(NSSortOptions)opts usingComparator:(NSComparator)cmptr {
315+
- (void)sortWithOptions:(NSSortOptions)opts usingComparator:(NSComparator NS_NOESCAPE)cmptr {
316316
LOCK([_arr sortWithOptions:opts usingComparator:cmptr]);
317317
}
318318

QiniuSDK/Utils/QNSystem.m

Lines changed: 1 addition & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -15,63 +15,7 @@
1515
#import <CoreServices/CoreServices.h>
1616
#endif
1717

18-
BOOL hasNSURLSession() {
19-
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED)
20-
float sysVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
21-
if (sysVersion < 7.0) {
22-
return NO;
23-
}
24-
#else
25-
NSOperatingSystemVersion sysVersion = [[NSProcessInfo processInfo] operatingSystemVersion];
26-
if (sysVersion.majorVersion < 10) {
27-
return NO;
28-
} else if (sysVersion.majorVersion == 10) {
29-
return sysVersion.minorVersion >= 9;
30-
}
31-
#endif
32-
return YES;
33-
}
34-
35-
BOOL hasAts() {
36-
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED)
37-
float sysVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
38-
if (sysVersion < 9.0) {
39-
return NO;
40-
}
41-
#else
42-
NSOperatingSystemVersion sysVersion = [[NSProcessInfo processInfo] operatingSystemVersion];
43-
if (sysVersion.majorVersion < 10) {
44-
return NO;
45-
} else if (sysVersion.majorVersion == 10) {
46-
return sysVersion.minorVersion >= 11;
47-
}
48-
#endif
49-
return YES;
50-
}
51-
52-
BOOL allowsArbitraryLoads() {
53-
if (!hasAts()) {
54-
return YES;
55-
}
56-
57-
// for unit test
58-
NSDictionary* d = [[NSBundle mainBundle] infoDictionary];
59-
if (d == nil || d.count == 0) {
60-
return YES;
61-
}
62-
63-
NSDictionary* sec = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSAppTransportSecurity"];
64-
if (sec == nil) {
65-
return NO;
66-
}
67-
NSNumber* ats = [sec objectForKey:@"NSAllowsArbitraryLoads"];
68-
if (ats == nil) {
69-
return NO;
70-
}
71-
return ats.boolValue;
72-
}
73-
74-
BOOL isIpV6FullySupported() {
18+
BOOL isIpV6FullySupported(void) {
7519
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED)
7620
float sysVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
7721
if (sysVersion < 9.0) {

QiniuSDK/Utils/QNVersion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
/**
1212
* sdk 版本
1313
*/
14-
static NSString *const kQiniuVersion = @"8.6.0";
14+
static NSString *const kQiniuVersion = @"8.7.0";

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
通过 CocoaPods
1515

1616
```ruby
17-
pod "Qiniu", "~> 8.6.0"
17+
pod "Qiniu", "~> 8.7.0"
1818
```
1919

2020
通过 Swift Package Manager (Xcode 11+)
@@ -26,7 +26,7 @@ File -> Swift Packages -> Add Package Dependency,输入库链接,选择相
2626
库对接:
2727
let package = Package(
2828
dependencies: [
29-
.package(url: "https://github.com/qiniu/objc-sdk", from: "8.5.3")
29+
.package(url: "https://github.com/qiniu/objc-sdk", from: "8.7.0")
3030
],
3131
// ...
3232
)
@@ -37,6 +37,7 @@ let package = Package(
3737

3838
| Qiniu SDK 版本 | 最低 iOS版本 | 最低 OS X 版本 | Notes |
3939
| :--------------------------------------: | :------: | :--------: | :-----------: |
40+
| 8.7.x | iOS 9 | OS X 10.15 | Xcode 最低版本 11 |
4041
| 8.6.x | iOS 7 | OS X 10.15 | Xcode 最低版本 11 |
4142
| 8.5.x | iOS 7 | OS X 10.15 | Xcode 最低版本 11 |
4243
| 8.4.x | iOS 7 | OS X 10.15 | Xcode 最低版本 11 |
@@ -75,12 +76,13 @@ let package = Package(
7576
#import <QiniuSDK.h>
7677
...
7778
QNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
78-
builder.useHttps = NO;// 是否使用https
79-
builder.zone = [QNFixedZone zone0];// 指定华东区域
80-
// builder.zone = [QNFixedZone zone1];// 指定华北区域
81-
// builder.zone = [QNFixedZone zone2];// 指定华南区域
82-
// builder.zone = [QNFixedZone zoneNa0];// 指定北美区域
83-
// builder.zone = [QNFixedZone zoneAs0];// 指定东南亚区域
79+
builder.useHttps = YES;// 是否使用https
80+
builder.zone = [[QNAutoZone alloc] init];// 根据 bucket 自动查询区域
81+
// builder.zone = [QNFixedZone createWithRegionId:@"z0"];// 指定华东区域
82+
// builder.zone = [QNFixedZone createWithRegionId:@"z1"];// 指定华北区域
83+
// builder.zone = [QNFixedZone createWithRegionId:@"z2"];// 指定华南区域
84+
// builder.zone = [QNFixedZone createWithRegionId:@"na0"];// 指定北美区域
85+
// builder.zone = [QNFixedZone createWithRegionId:@"as0"];// 指定东南亚区域
8486
}];
8587
8688
QNUploadManager *upManager = [[QNUploadManager alloc] initWithConfiguration:config];

0 commit comments

Comments
 (0)