Merge branch 'development' into swift2.3

* development:
  bump version
  add check for bad paths
  Fix socketpollable crashing
  make nonobjc
  More privatisation
  Making publicKeyChainForTrust() private.
  api extensions doesn't seem to fail for me
  update readme
  don't use api extensions only
This commit is contained in:
Erik 2016-07-29 19:43:18 -04:00
commit ea1fc1b0cc
No known key found for this signature in database
GPG Key ID: 4930B7C5FBC1A69D
4 changed files with 28 additions and 16 deletions

View File

@ -88,21 +88,21 @@ 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`.
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.6' # Or latest version
end
```
Install pods:
@ -121,7 +121,7 @@ import SocketIOClientSwift
Objective-C:
```Objective-C
#import <SocketIOClientSwift/SocketIOClientSwift-Swift.h>
@import SocketIOClientSwift;
```
CocoaSeeds
@ -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`.

View File

@ -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

View File

@ -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
@nonobjc var pubKeys: [SecKeyRef]? //the public keys
var usePublicKeys = false //use public keys or certificate validation?
/**
@ -240,7 +240,7 @@ public class SSLSecurity : NSObject {
- returns: the public keys from the certifcate chain for the trust
*/
func publicKeyChainForTrust(trust: SecTrustRef) -> [SecKeyRef] {
@nonobjc func publicKeyChainForTrust(trust: SecTrustRef) -> [SecKeyRef] {
let policy = SecPolicyCreateBasicX509()
let keys = (0..<SecTrustGetCertificateCount(trust)).reduce([SecKeyRef]()) { (keys: [SecKeyRef], index: Int) -> [SecKeyRef] in
var keys = keys

View File

@ -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)
@ -102,6 +102,10 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
forceWebsockets = force
case let .Path(path):
socketPath = path
if !socketPath.hasSuffix("/") {
socketPath += "/"
}
case let .VoipEnabled(enable):
voipEnabled = enable
case let .Secure(secure):
@ -117,6 +121,8 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
super.init()
sessionDelegate = sessionDelegate ?? self
(urlPolling, urlWebSocket) = createURLs()
}
@ -205,9 +211,7 @@ public final class SocketEngine : NSObject, SocketEnginePollable, SocketEngineWe
}
}
dispatch_async(emitQueue) {
self.doLongPoll(reqPolling)
}
doLongPoll(reqPolling)
}
private func createURLs() -> (NSURL, NSURL) {
@ -456,7 +460,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 +553,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")
}
}