From 17dfe4b2d38581f2d0b1e7957ed8d6e196c9827d Mon Sep 17 00:00:00 2001 From: Ricardo Pereira Date: Thu, 16 Nov 2017 07:34:31 +0000 Subject: [PATCH] Fix: ambiguous reference to member 'dataTask(with:completionHandler:)' (#648) * Fix ambiguous reference to member 'dataTask(with:completionHandler:)' * Travis: update Fastlane * Travis: setup Carthage * Travis: Fastlane already installed * Travis: upgrade Carthage --- .travis.yml | 8 ++++-- Examples/Tests/Podfile.lock | 8 +++--- .../Tests/Tests.xcodeproj/project.pbxproj | 28 +++++++++++++++++-- Examples/Tests/TestsTests/TestsTests.swift | 16 +++++------ Scripts/run_examples_tests.sh | 2 +- 5 files changed, 44 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6b92a249e..650efb11b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,14 +6,16 @@ env: - LANG=en_US.UTF-8 before_install: install: - # Install Scan - - gem install scan -v 0.14.2 + - brew update + - brew upgrade carthage # CocoaPods - pod install + # Carthage + - carthage bootstrap script: # Run tests # Use `travis_wait` when a long running command or compile step regularly takes longer than 10 minutes without producing any output. # It writes a short line to the build log every minute for 20 minutes, extending the amount of time your command has to finish. # Prefix `travis_wait` with a greater number to extend the wait time. - - scan --scheme "Ably" --open_report false --devices "iPhone 6s" + - fastlane scan --scheme "Ably" --open_report false --devices "iPhone 6s" - bash ./Scripts/run_examples_tests.sh diff --git a/Examples/Tests/Podfile.lock b/Examples/Tests/Podfile.lock index d3a871086..f0fa3949d 100644 --- a/Examples/Tests/Podfile.lock +++ b/Examples/Tests/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - Ably (1.0.6): + - Ably (1.0.9): - KSCrashAblyFork (= 1.15.8-ably-1) - msgpack (= 0.1.8) - SocketRocket (= 0.5.1) @@ -74,14 +74,14 @@ DEPENDENCIES: EXTERNAL SOURCES: Ably: - :path: "../.." + :path: ../.. SPEC CHECKSUMS: - Ably: 86578d591c0a840c82e099a73e23b29466ff6af5 + Ably: cc4bc164d4c5a0b904b1390b54985c7fadfd939f KSCrashAblyFork: 6d0dd5b033710109a8fdde28103eeb0e7f9ba1f7 msgpack: 97491d2ea799408f4694f2c7d7fd79baf77853dd SocketRocket: d57c7159b83c3c6655745cd15302aa24b6bae531 PODFILE CHECKSUM: 6af34bf7f91045b23539816c1d0cfe253bec5ea5 -COCOAPODS: 1.2.1 +COCOAPODS: 1.3.1 diff --git a/Examples/Tests/Tests.xcodeproj/project.pbxproj b/Examples/Tests/Tests.xcodeproj/project.pbxproj index 2758c75d3..effa1c519 100644 --- a/Examples/Tests/Tests.xcodeproj/project.pbxproj +++ b/Examples/Tests/Tests.xcodeproj/project.pbxproj @@ -241,13 +241,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Tests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; 4B4F9EED98BC61874DAB2F62 /* [CP] Check Pods Manifest.lock */ = { @@ -256,13 +259,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-TestsTests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; 751C5C44401069CC5CAAEE9B /* [CP] Embed Pods Frameworks */ = { @@ -271,9 +277,18 @@ files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-Tests/Pods-Tests-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/Ably/Ably.framework", + "${BUILT_PRODUCTS_DIR}/KSCrashAblyFork/KSCrashAblyFork.framework", + "${BUILT_PRODUCTS_DIR}/SocketRocket/SocketRocket.framework", + "${BUILT_PRODUCTS_DIR}/msgpack/msgpack.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Ably.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/KSCrashAblyFork.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SocketRocket.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/msgpack.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -316,9 +331,18 @@ files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-TestsTests/Pods-TestsTests-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/Ably/Ably.framework", + "${BUILT_PRODUCTS_DIR}/KSCrashAblyFork/KSCrashAblyFork.framework", + "${BUILT_PRODUCTS_DIR}/SocketRocket/SocketRocket.framework", + "${BUILT_PRODUCTS_DIR}/msgpack/msgpack.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Ably.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/KSCrashAblyFork.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SocketRocket.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/msgpack.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; diff --git a/Examples/Tests/TestsTests/TestsTests.swift b/Examples/Tests/TestsTests/TestsTests.swift index 5d72340b7..e6309067b 100644 --- a/Examples/Tests/TestsTests/TestsTests.swift +++ b/Examples/Tests/TestsTests/TestsTests.swift @@ -10,9 +10,8 @@ import XCTest import Ably @testable import Tests - - class TestsTests: XCTestCase { + let options: ARTClientOptions! = nil func testAblyWorks() { @@ -26,14 +25,14 @@ class TestsTests: XCTestCase { "Accept" : "application/json", "Content-Type" : "application/json" ] - URLSession.shared.dataTask(with: request, completionHandler: { data, _, error in + URLSession.shared.dataTask(with: request as URLRequest) { data, _, error in defer { postAppExpectation.fulfill() } if let e = error { XCTFail("Error setting up sandbox app: \(e)") return } responseData = data - }) .resume() + }.resume() self.waitForExpectations(timeout: 10, handler: nil) guard let key = responseData @@ -65,22 +64,23 @@ class TestsTests: XCTestCase { let backgroundRealtimeExpectation = self.expectation(description: "Realtime in a Background Queue") var realtime: ARTRealtime! //strong reference - URLSession.shared.dataTask(with: URL(string:"https://ably.io")!, completionHandler: { _ in + URLSession.shared.dataTask(with: URL(string: "https://ably.io")!) { _ in realtime = ARTRealtime(key: key as String) realtime.channels.get("foo").attach { _ in defer { backgroundRealtimeExpectation.fulfill() } } - }) .resume() + } .resume() self.waitForExpectations(timeout: 10, handler: nil) let backgroundRestExpectation = self.expectation(description: "Rest in a Background Queue") var rest: ARTRest! //strong reference - URLSession.shared.dataTask(with: URL(string:"https://ably.io")!, completionHandler: { _ in + URLSession.shared.dataTask(with: URL(string: "https://ably.io")!) { _ in rest = ARTRest(key: key as String) rest.channels.get("foo").history { _ in defer { backgroundRestExpectation.fulfill() } } - }) .resume() + }.resume() self.waitForExpectations(timeout: 10, handler: nil) } + } diff --git a/Scripts/run_examples_tests.sh b/Scripts/run_examples_tests.sh index 7cb7037d4..5b612eac0 100644 --- a/Scripts/run_examples_tests.sh +++ b/Scripts/run_examples_tests.sh @@ -5,4 +5,4 @@ set -e cd "Examples/Tests" pod install -scan -s Tests +fastlane scan -s Tests