Skip to content
This repository has been archived by the owner on Jul 1, 2019. It is now read-only.

Commit

Permalink
Swift 3.1 support
Browse files Browse the repository at this point in the history
  • Loading branch information
shams-ahmed committed May 10, 2017
1 parent a59f938 commit 02f0bf4
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 20 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Verify iOS SDK Changelog

### v1.0.6 (10/05/2017)

- Swift 3.1 support

### v1.0.4 (16/11/2016)

* New: Push notification sent from APNS
Expand Down
2 changes: 1 addition & 1 deletion DeviceProperties/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.0.6</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion Nexmo/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.0.6</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
Expand Down
2 changes: 1 addition & 1 deletion NexmoVerify.podspec.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "NexmoVerify",
"version": "1.0.5",
"version": "1.0.6",
"license": {
"type": "Custom"
},
Expand Down
14 changes: 7 additions & 7 deletions NexmoVerifyTests/VerifyIosSdkTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class VerifyIosSdkTests: XCTestCase {
}

XCTAssertEqual(200, response!.statusCode, "HttpRequest returned status code [ \(response!.statusCode)")
VerifyIosSdkTests.Log.info("Response body = \(response!.body)")
VerifyIosSdkTests.Log.info("Response body = \(String(describing: response!.body))")

requestFinished.fulfill()
}
Expand Down Expand Up @@ -234,7 +234,7 @@ class VerifyIosSdkTests: XCTestCase {
}

XCTAssertEqual(200, response!.statusCode, "HttpRequest returned status code [ \(response!.statusCode)")
VerifyIosSdkTests.Log.info("Response body = \(response!.body)")
VerifyIosSdkTests.Log.info("Response body = \(String(describing: response!.body))")

if let body = response!.body,
let json = (try? JSONSerialization.jsonObject(with: body.data(using: .utf8, allowLossyConversion: false)!, options: JSONSerialization.ReadingOptions.mutableContainers)) as? [String: AnyObject] {
Expand Down Expand Up @@ -270,14 +270,14 @@ class VerifyIosSdkTests: XCTestCase {
VerifyIosSdkTests.Log.info("Successfully connected to internet")
let ipAddress = SDKDeviceProperties.sharedInstance().getIpAddress()
XCTAssertNotNil(ipAddress, "IP Address returned null")
VerifyIosSdkTests.Log.info("IP Address returned = \(ipAddress)")
VerifyIosSdkTests.Log.info("IP Address returned = \(String(describing: ipAddress))")
}

/** Test retrieving or creating the unique device identifier */
func testGetUid() {
let uid = SDKDeviceProperties.sharedInstance().getUniqueDeviceIdentifierAsString()
XCTAssertNotNil(uid, "Uid returned was nil!")
VerifyIosSdkTests.Log.info("Returned UID = \(uid)")
VerifyIosSdkTests.Log.info("Returned UID = \(String(describing: uid))")
}

func testVerifySuccess() {
Expand Down Expand Up @@ -400,7 +400,7 @@ class VerifyIosSdkTests: XCTestCase {
VerifyClient.sharedInstance.getVerifiedUser(countryCode: nil, phoneNumber: VerifyIosSdkTests.TEST_NUMBER, onVerifyInProgress: {
sleep(30)
VerifyClient.cancelVerification() { error in
XCTAssertNil(error, "Cancel request returned error: \(error)")
XCTAssertNil(error, "Cancel request returned error: \(String(describing: error))")
cancelExpectation.fulfill()
}
}, onUserVerified: {
Expand Down Expand Up @@ -430,7 +430,7 @@ class VerifyIosSdkTests: XCTestCase {
let nextEventExpetation = expectation(description: "trigger next event callback")
VerifyClient.getVerifiedUser(countryCode: nil, phoneNumber: VerifyIosSdkTests.TEST_NUMBER, onVerifyInProgress: {
VerifyClient.triggerNextEvent() { error in
XCTAssertNil(error, "triggerNextEvent request returned error: \(error)")
XCTAssertNil(error, "triggerNextEvent request returned error: \(String(describing: error))")
nextEventExpetation.fulfill()
}
}, onUserVerified: {
Expand All @@ -447,7 +447,7 @@ class VerifyIosSdkTests: XCTestCase {
NexmoClient.start(applicationId: VerifyIosSdkTests.APP_KEY, sharedSecretKey: VerifyIosSdkTests.APP_SECRET)
let searchExpectation = expectation(description: "search callback")
VerifyClient.getUserStatus(countryCode: VerifyIosSdkTests.TEST_COUNTRY_CODE, number: VerifyIosSdkTests.TEST_NUMBER) { status, error in
XCTAssertNil(error, "search request returned error: \(error)")
XCTAssertNil(error, "search request returned error: \(String(describing: error))")
if let status = status {
print("search returned user status: \(status)")
}
Expand Down
2 changes: 1 addition & 1 deletion RequestSigning/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.0.6</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
10 changes: 6 additions & 4 deletions VerifySDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@
1091949A1DE48C9F00AC3E68 = {
CreatedOnToolsVersion = 8.2;
LastSwiftMigration = 0820;
ProvisioningStyle = Manual;
ProvisioningStyle = Automatic;
};
109194AD1DE5AD8B00AC3E68 = {
CreatedOnToolsVersion = 8.2;
Expand Down Expand Up @@ -1254,13 +1254,14 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = 7F2B5ZSP8Q;
INFOPLIST_FILE = NexmoDevicePropertiesTest/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.nexmo.verify.NexmoDevicePropertiesTest;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "ad1a5840-00a5-4333-957f-ce9408e2cf58";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OBJC_BRIDGING_HEADER = "NexmoDevicePropertiesTest/NexmoDevicePropertiesTest-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -1282,7 +1283,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.nexmo.verify.NexmoDevicePropertiesTest;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "ad1a5840-00a5-4333-957f-ce9408e2cf58";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "NexmoDevicePropertiesTest/NexmoDevicePropertiesTest-Bridging-Header.h";
SWIFT_VERSION = 3.0;
};
Expand Down
4 changes: 2 additions & 2 deletions VerifySDK/BaseResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class BaseResponse {
if (digest == signature) {
return true
} else {
BaseResponse.Log.error("Generated signature [ \(digest) ] didn't match response signature [ \(signature) ]")
BaseResponse.Log.error("Generated signature [ \(String(describing: digest)) ] didn't match response signature [ \(signature) ]")
return false
}
}
Expand All @@ -108,7 +108,7 @@ class BaseResponse {
if (digest == signature) {
return true
} else {
BaseResponse.Log.error("Generated signature [ \(digest) ] didn't match response signature [ \(signature) ]")
BaseResponse.Log.error("Generated signature [ \(String(describing: digest)) ] didn't match response signature [ \(String(describing: signature)) ]")
return false
}
}
Expand Down
2 changes: 1 addition & 1 deletion VerifySDK/HttpRequestBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class HttpRequestBuilder {

// content-type and charset
let charsetName = CFStringConvertEncodingToIANACharSetName(CFStringConvertNSStringEncodingToEncoding(self.encoding.rawValue))
request.addValue(self.contentType.rawValue + "; charset=" + (charsetName as! String), forHTTPHeaderField: "Content-Type")
request.addValue(self.contentType.rawValue + "; charset=" + (charsetName! as String), forHTTPHeaderField: "Content-Type")

return HttpRequest(request: request as URLRequest, encoding: self.encoding)
}
Expand Down
2 changes: 1 addition & 1 deletion VerifySDK/HttpResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class HttpResponse {
self.statusCode = response.statusCode
self.headers = response.allHeaderFields

if let stringData = NSString(data: data, encoding: encoding.rawValue) as? String {
if let stringData = NSString(data: data, encoding: encoding.rawValue) as String? {
self.body = stringData
HttpResponse.Log.info("message body = \(stringData)")
} else {
Expand Down
2 changes: 1 addition & 1 deletion VerifySDK/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.0.6</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down

0 comments on commit 02f0bf4

Please sign in to comment.