From af77e984ab8297ceefb2af74aab797430e73c4e2 Mon Sep 17 00:00:00 2001 From: Erik Little Date: Fri, 22 Jul 2016 09:13:03 -0400 Subject: [PATCH 1/9] don't use api extensions only --- Socket.IO-Client-Swift.xcodeproj/project.pbxproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/Socket.IO-Client-Swift.xcodeproj/project.pbxproj b/Socket.IO-Client-Swift.xcodeproj/project.pbxproj index d005db9..392f9ea 100644 --- a/Socket.IO-Client-Swift.xcodeproj/project.pbxproj +++ b/Socket.IO-Client-Swift.xcodeproj/project.pbxproj @@ -814,7 +814,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - APPLICATION_EXTENSION_API_ONLY = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -871,7 +870,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; - APPLICATION_EXTENSION_API_ONLY = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; From 1d56759276f43f7820509c55d3ee870a9ba74f40 Mon Sep 17 00:00:00 2001 From: Erik Date: Sun, 24 Jul 2016 09:49:07 -0400 Subject: [PATCH 2/9] update readme --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 38df018..755caed 100644 --- a/README.md +++ b/README.md @@ -93,16 +93,16 @@ github "socketio/socket.io-client-swift" ~> 6.1.5 # Or latest version Run `carthage update --platform ios,macosx`. -CocoaPods 0.36.0 or later (iOS 8+) +CocoaPods 1.0.0 or later ------------------ Create `Podfile` and add `pod 'Socket.IO-Client-Swift'`: ```ruby -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '8.0' use_frameworks! -pod 'Socket.IO-Client-Swift', '~> 6.1.5' # Or latest version +target 'YourApp' do + pod 'Socket.IO-Client-Swift', '~> 6.1.5' # Or latest version +end ``` Install pods: @@ -121,7 +121,7 @@ import SocketIOClientSwift Objective-C: ```Objective-C -#import +@import SocketIOClientSwift; ``` CocoaSeeds From 10d24c47eccbe905dfc5997d11d75833077b390f Mon Sep 17 00:00:00 2001 From: Erik Date: Sun, 24 Jul 2016 09:52:44 -0400 Subject: [PATCH 3/9] api extensions doesn't seem to fail for me --- Socket.IO-Client-Swift.xcodeproj/project.pbxproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Socket.IO-Client-Swift.xcodeproj/project.pbxproj b/Socket.IO-Client-Swift.xcodeproj/project.pbxproj index 392f9ea..d005db9 100644 --- a/Socket.IO-Client-Swift.xcodeproj/project.pbxproj +++ b/Socket.IO-Client-Swift.xcodeproj/project.pbxproj @@ -814,6 +814,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + APPLICATION_EXTENSION_API_ONLY = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; @@ -870,6 +871,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + APPLICATION_EXTENSION_API_ONLY = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; From 21d242ba6ae0560fa4477c04e377dc9b41c362ae Mon Sep 17 00:00:00 2001 From: Derek Clarkson Date: Mon, 25 Jul 2016 13:41:26 +1000 Subject: [PATCH 4/9] Making publicKeyChainForTrust() private. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To Fixing issue when attempting to build for a objective-c project. Exposed API won’t compile so hiding internal method. --- Source/SSLSecurity.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/SSLSecurity.swift b/Source/SSLSecurity.swift index 968e4eb..b3257e4 100644 --- a/Source/SSLSecurity.swift +++ b/Source/SSLSecurity.swift @@ -241,7 +241,7 @@ public class SSLSecurity : NSObject { - returns: the public keys from the certifcate chain for the trust */ - func publicKeyChainForTrust(trust: SecTrustRef) -> [SecKeyRef] { + private func publicKeyChainForTrust(trust: SecTrustRef) -> [SecKeyRef] { let policy = SecPolicyCreateBasicX509() let keys = (0.. [SecKeyRef] in var keys = keys From 99adb49736e36f2a230082ec8da3450875f15c06 Mon Sep 17 00:00:00 2001 From: Derek Clarkson Date: Mon, 25 Jul 2016 14:19:10 +1000 Subject: [PATCH 5/9] More privatisation --- Source/SSLSecurity.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/SSLSecurity.swift b/Source/SSLSecurity.swift index b3257e4..454fdc6 100644 --- a/Source/SSLSecurity.swift +++ b/Source/SSLSecurity.swift @@ -55,7 +55,7 @@ public class SSLSecurity : NSObject { var isReady = false //is the key processing done? var certificates: [NSData]? //the certificates - var pubKeys: [SecKeyRef]? //the public keys + private var pubKeys: [SecKeyRef]? //the public keys var usePublicKeys = false //use public keys or certificate validation? /** From a9aa28ae776cf263837a0446ea1946ef430f5b42 Mon Sep 17 00:00:00 2001 From: Erik Little Date: Wed, 27 Jul 2016 11:50:44 -0400 Subject: [PATCH 6/9] make nonobjc --- Source/SSLSecurity.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/SSLSecurity.swift b/Source/SSLSecurity.swift index 454fdc6..4ce1f7a 100644 --- a/Source/SSLSecurity.swift +++ b/Source/SSLSecurity.swift @@ -55,7 +55,7 @@ public class SSLSecurity : NSObject { var isReady = false //is the key processing done? var certificates: [NSData]? //the certificates - private var pubKeys: [SecKeyRef]? //the public keys + @nonobjc var pubKeys: [SecKeyRef]? //the public keys var usePublicKeys = false //use public keys or certificate validation? /** @@ -241,7 +241,7 @@ public class SSLSecurity : NSObject { - returns: the public keys from the certifcate chain for the trust */ - private func publicKeyChainForTrust(trust: SecTrustRef) -> [SecKeyRef] { + @nonobjc func publicKeyChainForTrust(trust: SecTrustRef) -> [SecKeyRef] { let policy = SecPolicyCreateBasicX509() let keys = (0.. [SecKeyRef] in var keys = keys From 637e0bb14c3d25d5b64a7471056f1d98df7aa56b Mon Sep 17 00:00:00 2001 From: Erik Date: Wed, 27 Jul 2016 21:16:48 -0400 Subject: [PATCH 7/9] Fix socketpollable crashing --- Source/SocketEngine.swift | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Source/SocketEngine.swift b/Source/SocketEngine.swift index 8630529..40e20d3 100644 --- a/Source/SocketEngine.swift +++ b/Source/SocketEngine.swift @@ -24,7 +24,7 @@ import Foundation -public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWebsocket { +public final class SocketEngine : NSObject, NSURLSessionDelegate, SocketEnginePollable, SocketEngineWebsocket { public let emitQueue = dispatch_queue_create("com.socketio.engineEmitQueue", DISPATCH_QUEUE_SERIAL) public let handleQueue = dispatch_queue_create("com.socketio.engineHandleQueue", DISPATCH_QUEUE_SERIAL) public let parseQueue = dispatch_queue_create("com.socketio.engineParseQueue", DISPATCH_QUEUE_SERIAL) @@ -117,6 +117,8 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe super.init() + sessionDelegate = sessionDelegate ?? self + (urlPolling, urlWebSocket) = createURLs() } @@ -205,9 +207,7 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe } } - dispatch_async(emitQueue) { - self.doLongPoll(reqPolling) - } + doLongPoll(reqPolling) } private func createURLs() -> (NSURL, NSURL) { @@ -456,7 +456,7 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe invalidated = false session = NSURLSession(configuration: .defaultSessionConfiguration(), delegate: sessionDelegate, - delegateQueue: NSOperationQueue()) + delegateQueue: NSOperationQueue.mainQueue()) sid = "" waitingForPoll = false waitingForPost = false @@ -549,3 +549,11 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe } } } + +extension SocketEngine { + public func URLSession(session: NSURLSession, didBecomeInvalidWithError error: NSError?) { + DefaultSocketLogger.Logger.error("Engine URLSession became invalid", type: "SocketEngine") + + didError("Engine URLSession became invalid") + } +} From d03d77aff82ae58ef9b6a557a6b8c6ca923ed7fc Mon Sep 17 00:00:00 2001 From: Erik Date: Thu, 28 Jul 2016 21:36:37 -0400 Subject: [PATCH 8/9] add check for bad paths --- Source/SocketEngine.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/SocketEngine.swift b/Source/SocketEngine.swift index 40e20d3..fb41c09 100644 --- a/Source/SocketEngine.swift +++ b/Source/SocketEngine.swift @@ -102,6 +102,10 @@ public final class SocketEngine : NSObject, NSURLSessionDelegate, SocketEnginePo forceWebsockets = force case let .Path(path): socketPath = path + + if !socketPath.hasSuffix("/") { + socketPath += "/" + } case let .VoipEnabled(enable): voipEnabled = enable case let .Secure(secure): From fcfb4092820aef3f79cba11fd5d6ca6bfd97910b Mon Sep 17 00:00:00 2001 From: Erik Date: Fri, 29 Jul 2016 19:34:22 -0400 Subject: [PATCH 9/9] bump version --- README.md | 6 +++--- Socket.IO-Client-Swift.podspec | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 755caed..7549222 100644 --- a/README.md +++ b/README.md @@ -88,7 +88,7 @@ Carthage ----------------- Add this line to your `Cartfile`: ``` -github "socketio/socket.io-client-swift" ~> 6.1.5 # Or latest version +github "socketio/socket.io-client-swift" ~> 6.1.6 # Or latest version ``` Run `carthage update --platform ios,macosx`. @@ -101,7 +101,7 @@ Create `Podfile` and add `pod 'Socket.IO-Client-Swift'`: use_frameworks! target 'YourApp' do - pod 'Socket.IO-Client-Swift', '~> 6.1.5' # Or latest version + pod 'Socket.IO-Client-Swift', '~> 6.1.6' # Or latest version end ``` @@ -130,7 +130,7 @@ CocoaSeeds Add this line to your `Seedfile`: ``` -github "socketio/socket.io-client-swift", "v6.1.5", :files => "Source/*.swift" # Or latest version +github "socketio/socket.io-client-swift", "v6.1.6", :files => "Source/*.swift" # Or latest version ``` Run `seed install`. diff --git a/Socket.IO-Client-Swift.podspec b/Socket.IO-Client-Swift.podspec index 6e768c1..ae9890b 100644 --- a/Socket.IO-Client-Swift.podspec +++ b/Socket.IO-Client-Swift.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "Socket.IO-Client-Swift" s.module_name = "SocketIOClientSwift" - s.version = "6.1.5" + s.version = "6.1.6" s.summary = "Socket.IO-client for iOS and OS X" s.description = <<-DESC Socket.IO-client for iOS and OS X. @@ -14,7 +14,7 @@ Pod::Spec.new do |s| s.ios.deployment_target = '8.0' s.osx.deployment_target = '10.10' s.tvos.deployment_target = '9.0' - s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v6.1.5' } + s.source = { :git => "https://github.com/socketio/socket.io-client-swift.git", :tag => 'v6.1.6' } s.source_files = "Source/**/*.swift" s.requires_arc = true # s.dependency 'Starscream', '~> 0.9' # currently this repo includes Starscream swift files