Skip to content

Commit b9fd1e3

Browse files
committed
Merge pull request #174 from longbai/ipv6
ipv6 support for ios8
2 parents a7ee25c + 9989475 commit b9fd1e3

File tree

14 files changed

+304
-326
lines changed

14 files changed

+304
-326
lines changed

.travis.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
language: objective-c
2-
before_install: true
3-
#- brew update
4-
#- brew upgrade xctool
5-
#- gem install cocoapods
2+
before_install:
3+
- rvm install 2.3.1
4+
- rvm use 2.3.1
5+
- brew update
6+
- brew outdated xctool || brew upgrade xctool
7+
- gem install cocoapods --pre
8+
- pod --version
9+
- pod repo remove master
10+
- pod setup
11+
- pod install --verbose --no-repo-update
612
before_script:
713
- export QINIU_TEST_ENV="travis"
814
script:
9-
- xctool -workspace QiniuSDK.xcworkspace -scheme "QiniuSDK iOS" -sdk iphonesimulator -configuration Release test -test-sdk iphonesimulator7.0 -freshInstall -freshSimulator
10-
- xctool -workspace QiniuSDK.xcworkspace -scheme "QiniuSDK Mac" -sdk macosx -configuration Release test -test-sdk macosx
15+
- xctool -workspace QiniuSDK.xcworkspace -scheme QiniuSDK_iOS -sdk iphonesimulator -configuration Release test -test-sdk iphonesimulator7.0 -freshInstall -freshSimulator
16+
- xctool -workspace QiniuSDK.xcworkspace -scheme QiniuSDK_Mac -sdk macosx -configuration Release test -test-sdk macosx

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#Changelog
22

3+
## 7.0.20 (2016-05-30)
4+
5+
### 修正
6+
* iOS8 ipv6 问题
7+
* 为ipv6兼容,happydns 指定为 0.3以上
8+
39
## 7.0.19 (2016-05-23)
410

511
### 修正

Podfile

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
11
source 'https://github.com/CocoaPods/Specs.git'
22

3-
target "QiniuSDK iOS" do
3+
def shared_dependencies
4+
pod "AFNetworking", "~> 2.5.0"
5+
pod "HappyDNS", ">= 0.3"
6+
end
7+
8+
def test_dependencies
9+
pod "AGAsyncTestHelper/Shorthand"
10+
end
11+
12+
target "QiniuSDK_iOS" do
413
platform :ios, "6.0"
5-
pod 'AFNetworking', '~> 2.5.0'
6-
pod 'HappyDNS', '>= 0.2'
14+
shared_dependencies
715
end
816

9-
target "QiniuSDK iOSTests" do
17+
target "QiniuSDK_iOSTests" do
1018
platform :ios, "6.0"
11-
pod 'AGAsyncTestHelper/Shorthand'
19+
shared_dependencies
20+
test_dependencies
1221
end
1322

14-
target "QiniuSDK Mac" do
23+
target "QiniuSDK_Mac" do
1524
platform :osx, "10.8"
16-
pod 'AFNetworking', '~> 2.5.0'
17-
pod 'HappyDNS', '>= 0.2'
25+
shared_dependencies
1826
end
1927

20-
target "QiniuSDK MacTests" do
28+
target "QiniuSDK_MacTests" do
2129
platform :osx, "10.8"
22-
pod 'AGAsyncTestHelper/Shorthand'
30+
shared_dependencies
31+
test_dependencies
2332
end

Qiniu.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'Qiniu'
3-
s.version = "7.0.19.1"
3+
s.version = "7.0.20"
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"
@@ -14,7 +14,7 @@ Pod::Spec.new do |s|
1414
s.requires_arc = true
1515
s.libraries = "z"
1616
s.dependency "AFNetworking", "~> 2.0"
17-
s.dependency "HappyDNS", "~> 0.2"
17+
s.dependency "HappyDNS", "~> 0.3"
1818
s.license = { :type => "MIT", :text => <<-LICENSE
1919
The MIT License (MIT)
2020

QiniuSDK.xcodeproj/project.pbxproj

Lines changed: 201 additions & 253 deletions
Large diffs are not rendered by default.

QiniuSDK.xcodeproj/xcshareddata/xcschemes/QiniuSDK Mac.xcscheme renamed to QiniuSDK.xcodeproj/xcshareddata/xcschemes/QiniuSDK_Mac.xcscheme

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0630"
3+
LastUpgradeVersion = "0730"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -15,57 +15,60 @@
1515
<BuildableReference
1616
BuildableIdentifier = "primary"
1717
BlueprintIdentifier = "DF2CDDFE19DAC05500CE01FB"
18-
BuildableName = "libQiniuSDK Mac.dylib"
19-
BlueprintName = "QiniuSDK Mac"
18+
BuildableName = "QiniuSDK_Mac.dylib"
19+
BlueprintName = "QiniuSDK_Mac"
2020
ReferencedContainer = "container:QiniuSDK.xcodeproj">
2121
</BuildableReference>
2222
</BuildActionEntry>
2323
</BuildActionEntries>
2424
</BuildAction>
2525
<TestAction
26+
buildConfiguration = "Debug"
2627
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2728
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
28-
shouldUseLaunchSchemeArgsEnv = "YES"
29-
buildConfiguration = "Debug">
29+
shouldUseLaunchSchemeArgsEnv = "YES">
3030
<Testables>
3131
<TestableReference
3232
skipped = "NO">
3333
<BuildableReference
3434
BuildableIdentifier = "primary"
3535
BlueprintIdentifier = "DF2CDE0919DAC05500CE01FB"
36-
BuildableName = "QiniuSDK MacTests.xctest"
37-
BlueprintName = "QiniuSDK MacTests"
36+
BuildableName = "QiniuSDK_MacTests.xctest"
37+
BlueprintName = "QiniuSDK_MacTests"
3838
ReferencedContainer = "container:QiniuSDK.xcodeproj">
3939
</BuildableReference>
4040
</TestableReference>
4141
</Testables>
42+
<AdditionalOptions>
43+
</AdditionalOptions>
4244
</TestAction>
4345
<LaunchAction
46+
buildConfiguration = "Debug"
4447
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4548
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
4649
launchStyle = "0"
4750
useCustomWorkingDirectory = "NO"
48-
buildConfiguration = "Debug"
4951
ignoresPersistentStateOnLaunch = "NO"
5052
debugDocumentVersioning = "YES"
53+
debugServiceExtension = "internal"
5154
allowLocationSimulation = "YES">
5255
<MacroExpansion>
5356
<BuildableReference
5457
BuildableIdentifier = "primary"
5558
BlueprintIdentifier = "DF2CDDFE19DAC05500CE01FB"
56-
BuildableName = "libQiniuSDK Mac.dylib"
57-
BlueprintName = "QiniuSDK Mac"
59+
BuildableName = "QiniuSDK_Mac.dylib"
60+
BlueprintName = "QiniuSDK_Mac"
5861
ReferencedContainer = "container:QiniuSDK.xcodeproj">
5962
</BuildableReference>
6063
</MacroExpansion>
6164
<AdditionalOptions>
6265
</AdditionalOptions>
6366
</LaunchAction>
6467
<ProfileAction
68+
buildConfiguration = "Release"
6569
shouldUseLaunchSchemeArgsEnv = "YES"
6670
savedToolIdentifier = ""
6771
useCustomWorkingDirectory = "NO"
68-
buildConfiguration = "Release"
6972
debugDocumentVersioning = "YES">
7073
</ProfileAction>
7174
<AnalyzeAction

QiniuSDK.xcodeproj/xcshareddata/xcschemes/QiniuSDK iOS.xcscheme renamed to QiniuSDK.xcodeproj/xcshareddata/xcschemes/QiniuSDK_iOS.xcscheme

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0630"
3+
LastUpgradeVersion = "0730"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -15,26 +15,26 @@
1515
<BuildableReference
1616
BuildableIdentifier = "primary"
1717
BlueprintIdentifier = "DF2CDE1919DAC08400CE01FB"
18-
BuildableName = "libQiniuSDK iOS.a"
19-
BlueprintName = "QiniuSDK iOS"
18+
BuildableName = "libQiniuSDK_iOS.a"
19+
BlueprintName = "QiniuSDK_iOS"
2020
ReferencedContainer = "container:QiniuSDK.xcodeproj">
2121
</BuildableReference>
2222
</BuildActionEntry>
2323
</BuildActionEntries>
2424
</BuildAction>
2525
<TestAction
26+
buildConfiguration = "Debug"
2627
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2728
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
28-
shouldUseLaunchSchemeArgsEnv = "YES"
29-
buildConfiguration = "Debug">
29+
shouldUseLaunchSchemeArgsEnv = "YES">
3030
<Testables>
3131
<TestableReference
3232
skipped = "NO">
3333
<BuildableReference
3434
BuildableIdentifier = "primary"
3535
BlueprintIdentifier = "DF2CDE2319DAC08400CE01FB"
36-
BuildableName = "QiniuSDK iOSTests.xctest"
37-
BlueprintName = "QiniuSDK iOSTests"
36+
BuildableName = "QiniuSDK_iOSTests.xctest"
37+
BlueprintName = "QiniuSDK_iOSTests"
3838
ReferencedContainer = "container:QiniuSDK.xcodeproj">
3939
</BuildableReference>
4040
</TestableReference>
@@ -43,45 +43,48 @@
4343
<BuildableReference
4444
BuildableIdentifier = "primary"
4545
BlueprintIdentifier = "DF2CDE1919DAC08400CE01FB"
46-
BuildableName = "libQiniuSDK iOS.a"
47-
BlueprintName = "QiniuSDK iOS"
46+
BuildableName = "libQiniuSDK_iOS.a"
47+
BlueprintName = "QiniuSDK_iOS"
4848
ReferencedContainer = "container:QiniuSDK.xcodeproj">
4949
</BuildableReference>
5050
</MacroExpansion>
51+
<AdditionalOptions>
52+
</AdditionalOptions>
5153
</TestAction>
5254
<LaunchAction
55+
buildConfiguration = "Debug"
5356
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5457
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
5558
launchStyle = "0"
5659
useCustomWorkingDirectory = "NO"
57-
buildConfiguration = "Debug"
5860
ignoresPersistentStateOnLaunch = "NO"
5961
debugDocumentVersioning = "YES"
62+
debugServiceExtension = "internal"
6063
allowLocationSimulation = "YES">
6164
<MacroExpansion>
6265
<BuildableReference
6366
BuildableIdentifier = "primary"
6467
BlueprintIdentifier = "DF2CDE1919DAC08400CE01FB"
65-
BuildableName = "libQiniuSDK iOS.a"
66-
BlueprintName = "QiniuSDK iOS"
68+
BuildableName = "libQiniuSDK_iOS.a"
69+
BlueprintName = "QiniuSDK_iOS"
6770
ReferencedContainer = "container:QiniuSDK.xcodeproj">
6871
</BuildableReference>
6972
</MacroExpansion>
7073
<AdditionalOptions>
7174
</AdditionalOptions>
7275
</LaunchAction>
7376
<ProfileAction
77+
buildConfiguration = "Release"
7478
shouldUseLaunchSchemeArgsEnv = "YES"
7579
savedToolIdentifier = ""
7680
useCustomWorkingDirectory = "NO"
77-
buildConfiguration = "Release"
7881
debugDocumentVersioning = "YES">
7982
<MacroExpansion>
8083
<BuildableReference
8184
BuildableIdentifier = "primary"
8285
BlueprintIdentifier = "DF2CDE1919DAC08400CE01FB"
83-
BuildableName = "libQiniuSDK iOS.a"
84-
BlueprintName = "QiniuSDK iOS"
86+
BuildableName = "libQiniuSDK_iOS.a"
87+
BlueprintName = "QiniuSDK_iOS"
8588
ReferencedContainer = "container:QiniuSDK.xcodeproj">
8689
</BuildableReference>
8790
</MacroExpansion>

QiniuSDK/Common/QNSystem.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ BOOL hasAts();
1515

1616
BOOL allowsArbitraryLoads();
1717

18-
//iOS8判断
19-
BOOL isIOS8();
18+
BOOL isIpV6FullySupported();
2019

2120
#endif /* QNSystem_h */

QiniuSDK/Common/QNSystem.m

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ BOOL hasNSURLSession() {
2323
}
2424
#else
2525
NSOperatingSystemVersion sysVersion = [[NSProcessInfo processInfo] operatingSystemVersion];
26-
if ((sysVersion.majorVersion <= 10 && sysVersion.minorVersion < 9)) {
26+
if (sysVersion.majorVersion < 10) {
2727
return NO;
28+
} else if (sysVersion.majorVersion == 10) {
29+
return sysVersion.minorVersion >= 9;
2830
}
2931
#endif
3032
return YES;
@@ -38,9 +40,10 @@ BOOL hasAts() {
3840
}
3941
#else
4042
NSOperatingSystemVersion sysVersion = [[NSProcessInfo processInfo] operatingSystemVersion];
41-
42-
if ((sysVersion.majorVersion <= 10 && sysVersion.minorVersion < 11)) {
43+
if (sysVersion.majorVersion < 10) {
4344
return NO;
45+
} else if (sysVersion.majorVersion == 10) {
46+
return sysVersion.minorVersion >= 11;
4447
}
4548
#endif
4649
return YES;
@@ -68,12 +71,19 @@ BOOL allowsArbitraryLoads() {
6871
return ats.boolValue;
6972
}
7073

71-
BOOL isIOS8() {
74+
BOOL isIpV6FullySupported() {
7275
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED)
7376
float sysVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
74-
if ((sysVersion >= 8.0) && sysVersion < 9.0) {
75-
return YES;
77+
if (sysVersion < 9.0) {
78+
return NO;
79+
}
80+
#else
81+
NSOperatingSystemVersion sysVersion = [[NSProcessInfo processInfo] operatingSystemVersion];
82+
if (sysVersion.majorVersion < 10) {
83+
return NO;
84+
} else if (sysVersion.majorVersion == 10) {
85+
return sysVersion.minorVersion >= 11;
7686
}
7787
#endif
78-
return NO;
79-
}
88+
return YES;
89+
}

QiniuSDK/Http/QNHttpManager.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#import "QNConfiguration.h"
1313
#import "QNHttpManager.h"
1414
#import "QNResponseInfo.h"
15+
#include "QNSystem.h"
1516
#import "QNUserAgent.h"
1617

1718
@interface QNHttpManager ()
@@ -176,7 +177,7 @@ - (void)sendRequest:(NSMutableURLRequest *)request
176177
url = [[NSURL alloc] initWithString:_converter(u)];
177178
request.URL = url;
178179
domain = url.host;
179-
} else if (_dns != nil && [url.scheme isEqual:@"http"]) {
180+
} else if (_dns != nil && [url.scheme isEqual:@"http"] && !(isIpV6FullySupported() && [QNIP isV6])) {
180181
ips = [_dns queryWithDomain:[[QNDomain alloc] init:domain hostsFirst:NO hasCname:YES maxTtl:1000]];
181182
double duration = [[NSDate date] timeIntervalSinceDate:startTime];
182183
if (ips == nil || ips.count == 0) {

0 commit comments

Comments
 (0)