diff options
Diffstat (limited to 'src/objective-c')
11 files changed, 447 insertions, 195 deletions
diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index 02492607cd..ea658bca2b 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -469,12 +469,6 @@ static NSString * const kBearerPrefix = @"Bearer "; [self sendHeaders:_requestHeaders]; [self invokeCall]; - // TODO(jcanizales): Extract this logic somewhere common. - NSString *host = [NSURL URLWithString:[@"https://" stringByAppendingString:_host]].host; - if (!host) { - // TODO(jcanizales): Check this on init. - [NSException raise:NSInvalidArgumentException format:@"host of %@ is nil", _host]; - } [GRPCConnectivityMonitor registerObserver:self selector:@selector(connectivityChanged:)]; } diff --git a/src/objective-c/tests/Connectivity/Base.lproj/Main.storyboard b/src/objective-c/tests/Connectivity/Base.lproj/Main.storyboard deleted file mode 100644 index 9a05b8635d..0000000000 --- a/src/objective-c/tests/Connectivity/Base.lproj/Main.storyboard +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11129.15" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r"> - <dependencies> - <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11103.10"/> - </dependencies> - <scenes> - <!--View Controller--> - <scene sceneID="tne-QT-ifu"> - <objects> - <viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController"/> - <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> - </objects> - </scene> - </scenes> -</document> diff --git a/src/objective-c/tests/Connectivity/ConnectivityTestingApp.xcodeproj/project.pbxproj b/src/objective-c/tests/Connectivity/ConnectivityTestingApp.xcodeproj/project.pbxproj index 3f26c98564..6a4c3519d6 100644 --- a/src/objective-c/tests/Connectivity/ConnectivityTestingApp.xcodeproj/project.pbxproj +++ b/src/objective-c/tests/Connectivity/ConnectivityTestingApp.xcodeproj/project.pbxproj @@ -3,90 +3,104 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 48; objects = { /* Begin PBXBuildFile section */ - 500A4E0AC9D489EB214D1ED4 /* libPods-ConnectivityTestingApp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C2AF815D8242A2172891621D /* libPods-ConnectivityTestingApp.a */; }; - 63BFB9CC1D2478DD00E17927 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 63BFB9CB1D2478DD00E17927 /* main.m */; }; - 63BFB9D21D2478DD00E17927 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 63BFB9D11D2478DD00E17927 /* ViewController.m */; }; - 63BFB9D51D2478DD00E17927 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 63BFB9D31D2478DD00E17927 /* Main.storyboard */; }; + 5EC49F992043E46B00ED189A /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EC49F982043E46B00ED189A /* ViewController.m */; }; + 5EC49F9C2043E46B00ED189A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5EC49F9A2043E46B00ED189A /* Main.storyboard */; }; + 5EC49F9E2043E46B00ED189A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5EC49F9D2043E46B00ED189A /* Assets.xcassets */; }; + 5EC49FA12043E46B00ED189A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5EC49F9F2043E46B00ED189A /* LaunchScreen.storyboard */; }; + 5EC49FA42043E46B00ED189A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EC49FA32043E46B00ED189A /* main.m */; }; + DDCBF00DB326F4FA4706953C /* libPods-ConnectivityTestingApp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EF1DD1BF13CC3E1BDA1A1089 /* libPods-ConnectivityTestingApp.a */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 63BFB9C71D2478DD00E17927 /* ConnectivityTestingApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ConnectivityTestingApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 63BFB9CB1D2478DD00E17927 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; }; - 63BFB9D11D2478DD00E17927 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = SOURCE_ROOT; }; - 63BFB9D41D2478DD00E17927 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; - 63BFB9DB1D2478DD00E17927 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = SOURCE_ROOT; }; - BA96CBC1612BD2F70E66246C /* Pods-ConnectivityTestingApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ConnectivityTestingApp.release.xcconfig"; path = "Pods/Target Support Files/Pods-ConnectivityTestingApp/Pods-ConnectivityTestingApp.release.xcconfig"; sourceTree = "<group>"; }; - C2AF815D8242A2172891621D /* libPods-ConnectivityTestingApp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ConnectivityTestingApp.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - FC9BD3AE427396EDB4CD13E3 /* Pods-ConnectivityTestingApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ConnectivityTestingApp.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ConnectivityTestingApp/Pods-ConnectivityTestingApp.debug.xcconfig"; sourceTree = "<group>"; }; + 5EC49F912043E46B00ED189A /* ConnectivityTestingApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ConnectivityTestingApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 5EC49F982043E46B00ED189A /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; }; + 5EC49F9B2043E46B00ED189A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; + 5EC49F9D2043E46B00ED189A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; + 5EC49FA02043E46B00ED189A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; + 5EC49FA22043E46B00ED189A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; + 5EC49FA32043E46B00ED189A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; + 69B8F09A730364513700F23C /* Pods-ConnectivityTestingApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ConnectivityTestingApp.release.xcconfig"; path = "Pods/Target Support Files/Pods-ConnectivityTestingApp/Pods-ConnectivityTestingApp.release.xcconfig"; sourceTree = "<group>"; }; + A16A6C6AAAC10A09DFF329F2 /* Pods-ConnectivityTestingApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ConnectivityTestingApp.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ConnectivityTestingApp/Pods-ConnectivityTestingApp.debug.xcconfig"; sourceTree = "<group>"; }; + EF1DD1BF13CC3E1BDA1A1089 /* libPods-ConnectivityTestingApp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ConnectivityTestingApp.a"; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 63BFB9C41D2478DD00E17927 /* Frameworks */ = { + 5EC49F8E2043E46B00ED189A /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 500A4E0AC9D489EB214D1ED4 /* libPods-ConnectivityTestingApp.a in Frameworks */, + DDCBF00DB326F4FA4706953C /* libPods-ConnectivityTestingApp.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 16E6C67F2E48B42376DFFD2A /* Pods */ = { + 1AAFFD715A6EF1FEBF5AD796 /* Pods */ = { isa = PBXGroup; children = ( - FC9BD3AE427396EDB4CD13E3 /* Pods-ConnectivityTestingApp.debug.xcconfig */, - BA96CBC1612BD2F70E66246C /* Pods-ConnectivityTestingApp.release.xcconfig */, + A16A6C6AAAC10A09DFF329F2 /* Pods-ConnectivityTestingApp.debug.xcconfig */, + 69B8F09A730364513700F23C /* Pods-ConnectivityTestingApp.release.xcconfig */, ); name = Pods; sourceTree = "<group>"; }; - 48F8EC18C66D3416A41F76F5 /* Frameworks */ = { + 5EC49F882043E46B00ED189A = { isa = PBXGroup; children = ( - C2AF815D8242A2172891621D /* libPods-ConnectivityTestingApp.a */, + 5EC49F932043E46B00ED189A /* ConnectivityTestingApp */, + 5EC49F922043E46B00ED189A /* Products */, + 1AAFFD715A6EF1FEBF5AD796 /* Pods */, + 99E308FECF6991F75249AD00 /* Frameworks */, ); - name = Frameworks; sourceTree = "<group>"; }; - 63BFB9BE1D2478DD00E17927 = { + 5EC49F922043E46B00ED189A /* Products */ = { isa = PBXGroup; children = ( - 63BFB9D11D2478DD00E17927 /* ViewController.m */, - 63BFB9D31D2478DD00E17927 /* Main.storyboard */, - 63BFB9DB1D2478DD00E17927 /* Info.plist */, - 63BFB9CB1D2478DD00E17927 /* main.m */, - 63BFB9C81D2478DD00E17927 /* Products */, - 16E6C67F2E48B42376DFFD2A /* Pods */, - 48F8EC18C66D3416A41F76F5 /* Frameworks */, + 5EC49F912043E46B00ED189A /* ConnectivityTestingApp.app */, ); + name = Products; sourceTree = "<group>"; }; - 63BFB9C81D2478DD00E17927 /* Products */ = { + 5EC49F932043E46B00ED189A /* ConnectivityTestingApp */ = { isa = PBXGroup; children = ( - 63BFB9C71D2478DD00E17927 /* ConnectivityTestingApp.app */, + 5EC49F982043E46B00ED189A /* ViewController.m */, + 5EC49F9A2043E46B00ED189A /* Main.storyboard */, + 5EC49F9D2043E46B00ED189A /* Assets.xcassets */, + 5EC49F9F2043E46B00ED189A /* LaunchScreen.storyboard */, + 5EC49FA22043E46B00ED189A /* Info.plist */, + 5EC49FA32043E46B00ED189A /* main.m */, ); - name = Products; + path = ConnectivityTestingApp; + sourceTree = "<group>"; + }; + 99E308FECF6991F75249AD00 /* Frameworks */ = { + isa = PBXGroup; + children = ( + EF1DD1BF13CC3E1BDA1A1089 /* libPods-ConnectivityTestingApp.a */, + ); + name = Frameworks; sourceTree = "<group>"; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 63BFB9C61D2478DD00E17927 /* ConnectivityTestingApp */ = { + 5EC49F902043E46B00ED189A /* ConnectivityTestingApp */ = { isa = PBXNativeTarget; - buildConfigurationList = 63BFB9DE1D2478DD00E17927 /* Build configuration list for PBXNativeTarget "ConnectivityTestingApp" */; + buildConfigurationList = 5EC49FA72043E46B00ED189A /* Build configuration list for PBXNativeTarget "ConnectivityTestingApp" */; buildPhases = ( - 4DCA2703A0AA5DC1BD2751B8 /* [CP] Check Pods Manifest.lock */, - 63BFB9C31D2478DD00E17927 /* Sources */, - 63BFB9C41D2478DD00E17927 /* Frameworks */, - 63BFB9C51D2478DD00E17927 /* Resources */, - 8593A2388A8F7BF5A7E98D26 /* [CP] Embed Pods Frameworks */, - 5347BF6C41E7888C1C05CD88 /* [CP] Copy Pods Resources */, + 7CABF198C569A04592862390 /* [CP] Check Pods Manifest.lock */, + 5EC49F8D2043E46B00ED189A /* Sources */, + 5EC49F8E2043E46B00ED189A /* Frameworks */, + 5EC49F8F2043E46B00ED189A /* Resources */, + 9F67C72B6B6BAF2781078886 /* [CP] Embed Pods Frameworks */, + 735516C793AF7394FBB83B7F /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -94,87 +108,93 @@ ); name = ConnectivityTestingApp; productName = ConnectivityTestingApp; - productReference = 63BFB9C71D2478DD00E17927 /* ConnectivityTestingApp.app */; + productReference = 5EC49F912043E46B00ED189A /* ConnectivityTestingApp.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ - 63BFB9BF1D2478DD00E17927 /* Project object */ = { + 5EC49F892043E46B00ED189A /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0920; ORGANIZATIONNAME = gRPC; TargetAttributes = { - 63BFB9C61D2478DD00E17927 = { - CreatedOnToolsVersion = 8.0; - DevelopmentTeam = EQHXZ8M8AV; - DevelopmentTeamName = "Google, Inc."; - ProvisioningStyle = Automatic; + 5EC49F902043E46B00ED189A = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Manual; }; }; }; - buildConfigurationList = 63BFB9C21D2478DD00E17927 /* Build configuration list for PBXProject "ConnectivityTestingApp" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + buildConfigurationList = 5EC49F8C2043E46B00ED189A /* Build configuration list for PBXProject "ConnectivityTestingApp" */; + compatibilityVersion = "Xcode 8.0"; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); - mainGroup = 63BFB9BE1D2478DD00E17927; - productRefGroup = 63BFB9C81D2478DD00E17927 /* Products */; + mainGroup = 5EC49F882043E46B00ED189A; + productRefGroup = 5EC49F922043E46B00ED189A /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( - 63BFB9C61D2478DD00E17927 /* ConnectivityTestingApp */, + 5EC49F902043E46B00ED189A /* ConnectivityTestingApp */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ - 63BFB9C51D2478DD00E17927 /* Resources */ = { + 5EC49F8F2043E46B00ED189A /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 63BFB9D51D2478DD00E17927 /* Main.storyboard in Resources */, + 5EC49FA12043E46B00ED189A /* LaunchScreen.storyboard in Resources */, + 5EC49F9E2043E46B00ED189A /* Assets.xcassets in Resources */, + 5EC49F9C2043E46B00ED189A /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 4DCA2703A0AA5DC1BD2751B8 /* [CP] Check Pods Manifest.lock */ = { + 735516C793AF7394FBB83B7F /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-ConnectivityTestingApp/Pods-ConnectivityTestingApp-resources.sh", + "${PODS_CONFIGURATION_BUILD_DIR}/gRPC/gRPCCertificates.bundle", ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Copy Pods Resources"; outputPaths = ( + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../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 = "\"${SRCROOT}/Pods/Target Support Files/Pods-ConnectivityTestingApp/Pods-ConnectivityTestingApp-resources.sh\"\n"; showEnvVarsInLog = 0; }; - 5347BF6C41E7888C1C05CD88 /* [CP] Copy Pods Resources */ = { + 7CABF198C569A04592862390 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); - name = "[CP] Copy Pods Resources"; + name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-ConnectivityTestingApp-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-ConnectivityTestingApp/Pods-ConnectivityTestingApp-resources.sh\"\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; }; - 8593A2388A8F7BF5A7E98D26 /* [CP] Embed Pods Frameworks */ = { + 9F67C72B6B6BAF2781078886 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -192,55 +212,72 @@ /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - 63BFB9C31D2478DD00E17927 /* Sources */ = { + 5EC49F8D2043E46B00ED189A /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 63BFB9D21D2478DD00E17927 /* ViewController.m in Sources */, - 63BFB9CC1D2478DD00E17927 /* main.m in Sources */, + 5EC49F992043E46B00ED189A /* ViewController.m in Sources */, + 5EC49FA42043E46B00ED189A /* main.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ - 63BFB9D31D2478DD00E17927 /* Main.storyboard */ = { + 5EC49F9A2043E46B00ED189A /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( - 63BFB9D41D2478DD00E17927 /* Base */, + 5EC49F9B2043E46B00ED189A /* Base */, ); name = Main.storyboard; - path = .; - sourceTree = SOURCE_ROOT; + sourceTree = "<group>"; + }; + 5EC49F9F2043E46B00ED189A /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 5EC49FA02043E46B00ED189A /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = "<group>"; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ - 63BFB9DC1D2478DD00E17927 /* Debug */ = { + 5EC49FA52043E46B00ED189A /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; @@ -254,38 +291,48 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; - 63BFB9DD1D2478DD00E17927 /* Release */ = { + 5EC49FA62043E46B00ED189A /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + CODE_SIGN_IDENTITY = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; @@ -293,61 +340,71 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.2; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; }; name = Release; }; - 63BFB9DF1D2478DD00E17927 /* Debug */ = { + 5EC49FA82043E46B00ED189A /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = FC9BD3AE427396EDB4CD13E3 /* Pods-ConnectivityTestingApp.debug.xcconfig */; + baseConfigurationReference = A16A6C6AAAC10A09DFF329F2 /* Pods-ConnectivityTestingApp.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = EQHXZ8M8AV; + INFOPLIST_FILE = ConnectivityTestingApp/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = io.grpc.ConnectivityTestingApp; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = "aa306b73-1a89-4299-8ead-c102fd059d96"; + PROVISIONING_PROFILE_SPECIFIER = "Google Development"; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = ../../../..; }; name = Debug; }; - 63BFB9E01D2478DD00E17927 /* Release */ = { + 5EC49FA92043E46B00ED189A /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = BA96CBC1612BD2F70E66246C /* Pods-ConnectivityTestingApp.release.xcconfig */; + baseConfigurationReference = 69B8F09A730364513700F23C /* Pods-ConnectivityTestingApp.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = EQHXZ8M8AV; + INFOPLIST_FILE = ConnectivityTestingApp/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = io.grpc.ConnectivityTestingApp; PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE = "aa306b73-1a89-4299-8ead-c102fd059d96"; + PROVISIONING_PROFILE_SPECIFIER = "Google Development"; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = ../../../..; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 63BFB9C21D2478DD00E17927 /* Build configuration list for PBXProject "ConnectivityTestingApp" */ = { + 5EC49F8C2043E46B00ED189A /* Build configuration list for PBXProject "ConnectivityTestingApp" */ = { isa = XCConfigurationList; buildConfigurations = ( - 63BFB9DC1D2478DD00E17927 /* Debug */, - 63BFB9DD1D2478DD00E17927 /* Release */, + 5EC49FA52043E46B00ED189A /* Debug */, + 5EC49FA62043E46B00ED189A /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 63BFB9DE1D2478DD00E17927 /* Build configuration list for PBXNativeTarget "ConnectivityTestingApp" */ = { + 5EC49FA72043E46B00ED189A /* Build configuration list for PBXNativeTarget "ConnectivityTestingApp" */ = { isa = XCConfigurationList; buildConfigurations = ( - 63BFB9DF1D2478DD00E17927 /* Debug */, - 63BFB9E01D2478DD00E17927 /* Release */, + 5EC49FA82043E46B00ED189A /* Debug */, + 5EC49FA92043E46B00ED189A /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; - rootObject = 63BFB9BF1D2478DD00E17927 /* Project object */; + rootObject = 5EC49F892043E46B00ED189A /* Project object */; } diff --git a/src/objective-c/tests/Connectivity/ConnectivityTestingApp/Assets.xcassets/AppIcon.appiconset/Contents.json b/src/objective-c/tests/Connectivity/ConnectivityTestingApp/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000000..1d060ed288 --- /dev/null +++ b/src/objective-c/tests/Connectivity/ConnectivityTestingApp/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,93 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +}
\ No newline at end of file diff --git a/src/objective-c/tests/Connectivity/ConnectivityTestingApp/Base.lproj/LaunchScreen.storyboard b/src/objective-c/tests/Connectivity/ConnectivityTestingApp/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000000..60a0921351 --- /dev/null +++ b/src/objective-c/tests/Connectivity/ConnectivityTestingApp/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> + <device id="retina4_7" orientation="portrait"> + <adaptation id="fullscreen"/> + </device> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/> + <capability name="Safe area layout guides" minToolsVersion="9.0"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> + </dependencies> + <scenes> + <!--View Controller--> + <scene sceneID="EHf-IW-A2E"> + <objects> + <viewController id="01J-lp-oVM" sceneMemberID="viewController"> + <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="q3l-Ud-sIn"> + <rect key="frame" x="167" y="131" width="41" height="30"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <state key="normal" title="Unary"/> + </button> + <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="RfU-eq-cee"> + <rect key="frame" x="152" y="220" width="70" height="30"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <state key="normal" title="Streaming"/> + </button> + </subviews> + <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/> + </view> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="53" y="375"/> + </scene> + </scenes> +</document> diff --git a/src/objective-c/tests/Connectivity/ConnectivityTestingApp/Base.lproj/Main.storyboard b/src/objective-c/tests/Connectivity/ConnectivityTestingApp/Base.lproj/Main.storyboard new file mode 100644 index 0000000000..1b4e0d050c --- /dev/null +++ b/src/objective-c/tests/Connectivity/ConnectivityTestingApp/Base.lproj/Main.storyboard @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r"> + <device id="retina4_7" orientation="portrait"> + <adaptation id="fullscreen"/> + </device> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/> + <capability name="Safe area layout guides" minToolsVersion="9.0"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> + </dependencies> + <scenes> + <!--View Controller--> + <scene sceneID="tne-QT-ifu"> + <objects> + <viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController"> + <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC"> + <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8QE-go-1ZJ"> + <rect key="frame" x="168" y="160" width="41" height="30"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <state key="normal" title="Unary"/> + <connections> + <action selector="tapUnary:" destination="BYZ-38-t0r" eventType="touchUpInside" id="OGf-25-OYx"/> + </connections> + </button> + <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="p4l-br-UUo"> + <rect key="frame" x="153" y="229" width="70" height="30"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> + <state key="normal" title="Streaming"/> + <connections> + <action selector="tapStreaming:" destination="BYZ-38-t0r" eventType="touchUpInside" id="S3O-W8-Fed"/> + </connections> + </button> + </subviews> + <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/> + </view> + </viewController> + <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> + </objects> + </scene> + </scenes> +</document> diff --git a/src/objective-c/tests/Connectivity/Info.plist b/src/objective-c/tests/Connectivity/ConnectivityTestingApp/Info.plist index 8a9fb88701..16be3b6811 100644 --- a/src/objective-c/tests/Connectivity/Info.plist +++ b/src/objective-c/tests/Connectivity/ConnectivityTestingApp/Info.plist @@ -3,7 +3,7 @@ <plist version="1.0"> <dict> <key>CFBundleDevelopmentRegion</key> - <string>en</string> + <string>$(DEVELOPMENT_LANGUAGE)</string> <key>CFBundleExecutable</key> <string>$(EXECUTABLE_NAME)</string> <key>CFBundleIdentifier</key> @@ -16,14 +16,12 @@ <string>APPL</string> <key>CFBundleShortVersionString</key> <string>1.0</string> - <key>CFBundleSignature</key> - <string>????</string> <key>CFBundleVersion</key> <string>1</string> <key>LSRequiresIPhoneOS</key> <true/> <key>UILaunchStoryboardName</key> - <string>Main</string> + <string>LaunchScreen</string> <key>UIMainStoryboardFile</key> <string>Main</string> <key>UIRequiredDeviceCapabilities</key> @@ -36,5 +34,12 @@ <string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeRight</string> </array> + <key>UISupportedInterfaceOrientations~ipad</key> + <array> + <string>UIInterfaceOrientationPortrait</string> + <string>UIInterfaceOrientationPortraitUpsideDown</string> + <string>UIInterfaceOrientationLandscapeLeft</string> + <string>UIInterfaceOrientationLandscapeRight</string> + </array> </dict> </plist> diff --git a/src/objective-c/tests/Connectivity/ConnectivityTestingApp/ViewController.m b/src/objective-c/tests/Connectivity/ConnectivityTestingApp/ViewController.m new file mode 100644 index 0000000000..f91d2a6b62 --- /dev/null +++ b/src/objective-c/tests/Connectivity/ConnectivityTestingApp/ViewController.m @@ -0,0 +1,101 @@ +/* + * + * Copyright 2016 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#import <UIKit/UIKit.h> + +#import <GRPCClient/GRPCCall.h> +#import <ProtoRPC/ProtoMethod.h> +#import <RxLibrary/GRXWriter+Immediate.h> +#import <RxLibrary/GRXWriter+Transformations.h> +#import <RxLibrary/GRXBufferedPipe.h> + +#import "src/objective-c/GRPCClient/private/GRPCConnectivityMonitor.h" + +NSString *host = @"grpc-test.sandbox.googleapis.com"; + +@interface ViewController : UIViewController +@end + +@implementation ViewController +- (void)viewDidLoad { + [super viewDidLoad]; + + [GRPCConnectivityMonitor registerObserver:self + selector:@selector(reachabilityChanged:)]; +} + +- (void)reachabilityChanged:(NSNotification *)note { + NSLog(@"Reachability changed\n"); +} + +- (IBAction)tapUnary:(id)sender { + // Create a unary call + + // A trivial proto message to generate a response + char bytes[] = {0x10, 0x05, 0x1A, 0x07, 0x12, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00}; + + GRPCProtoMethod *method = [[GRPCProtoMethod alloc] initWithPackage:@"grpc.testing" + service:@"TestService" + method:@"UnaryCall"]; + GRXWriter *loggingRequestWriter = + [[GRXWriter writerWithValue:[NSData dataWithBytes:bytes length:sizeof(bytes)]] + map:^id(id value) { + NSLog(@"Sending request."); + return value; + }]; + GRPCCall *call = [[GRPCCall alloc] initWithHost:host + path:method.HTTPPath + requestsWriter:loggingRequestWriter]; + + [call startWithWriteable:[GRXWriteable writeableWithEventHandler:^(BOOL done, id value, + NSError *error) { + if (!done) { + return; + } + NSLog(@"Unary call finished with error: %@", error); + }]]; +} + +- (IBAction)tapStreaming:(id)sender { + // Create a streaming call + + // A trivial proto message to generate a response + char bytes[] = {0x12, 0x02, 0x08, 0x02, 0x1A, 0x04, 0x12, 0x02, 0x00, 0x00}; + + GRPCProtoMethod *method = [[GRPCProtoMethod alloc] initWithPackage:@"grpc.testing" + service:@"TestService" + method:@"FullDuplexCall"]; + + GRXBufferedPipe *requestsBuffer = [[GRXBufferedPipe alloc] init]; + + [requestsBuffer writeValue:[NSData dataWithBytes:bytes length:sizeof(bytes)]]; + + GRPCCall *call = [[GRPCCall alloc] initWithHost:host + path:method.HTTPPath + requestsWriter:requestsBuffer]; + + [call startWithWriteable:[GRXWriteable writeableWithEventHandler:^(BOOL done, id value, + NSError *error) { + if (!done) { + return; + } + NSLog(@"Streaming call finished with error: %@", error); + }]]; +} + +@end diff --git a/src/objective-c/tests/Connectivity/main.m b/src/objective-c/tests/Connectivity/ConnectivityTestingApp/main.m index 1642fdb2c6..1642fdb2c6 100644 --- a/src/objective-c/tests/Connectivity/main.m +++ b/src/objective-c/tests/Connectivity/ConnectivityTestingApp/main.m diff --git a/src/objective-c/tests/Connectivity/README.md b/src/objective-c/tests/Connectivity/README.md index 851cb9d1da..907821e800 100644 --- a/src/objective-c/tests/Connectivity/README.md +++ b/src/objective-c/tests/Connectivity/README.md @@ -2,14 +2,12 @@ This app can be used to manually test gRPC under changing network conditions. It makes RPCs in a loop, logging when the request is sent and the response is received. -To test on the simulator, run `pod install`, open the workspace created by Cocoapods, and run the app. -Once running, disable WiFi (or ethernet) _in your computer_, then enable it again after a while. Don't -bother with the simulator's WiFi or cell settings, as they have no effect: Simulator apps are just Mac -apps running within the simulator UI. +To test on the simulator, run `pod install`, open the workspace created by Cocoapods, and run the +app on an iOS device. Once running, tap a few times of each of the two buttons to make a few unary and streaming +calls. Then disable/enable different network interfaces (WiFi, cellular) on your device. -The expected result is to never see a "hanged" RPC: success or failure should happen almost immediately -after sending the request. Symptom of a hanged RPC is a log like the following being the last in your -console: +The expected behavior is that the pending streaming calls fails immediately with error UNAVAILABLE. +Moreover, when network comes back, new calls have the same behavior. ``` 2016-06-29 16:51:29.443 ConnectivityTestingApp[73129:3567949] Sending request. diff --git a/src/objective-c/tests/Connectivity/ViewController.m b/src/objective-c/tests/Connectivity/ViewController.m deleted file mode 100644 index e39f3be594..0000000000 --- a/src/objective-c/tests/Connectivity/ViewController.m +++ /dev/null @@ -1,67 +0,0 @@ -/* - * - * Copyright 2016 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#import <UIKit/UIKit.h> - -#import <GRPCClient/GRPCCall.h> -#import <ProtoRPC/ProtoMethod.h> -#import <RxLibrary/GRXWriter+Immediate.h> -#import <RxLibrary/GRXWriter+Transformations.h> - -@interface ViewController : UIViewController -@end - -@implementation ViewController -- (void)viewDidLoad { - [super viewDidLoad]; - - NSString *host = @"grpc-test.sandbox.googleapis.com"; - - GRPCProtoMethod *method = [[GRPCProtoMethod alloc] initWithPackage:@"grpc.testing" - service:@"TestService" - method:@"StreamingOutputCall"]; - - __block void (^startCall)() = ^{ - GRXWriter *loggingRequestWriter = [[GRXWriter writerWithValue:[NSData data]] map:^id(id value) { - NSLog(@"Sending request."); - return value; - }]; - - GRPCCall *call = [[GRPCCall alloc] initWithHost:host - path:method.HTTPPath - requestsWriter:loggingRequestWriter]; - - [call startWithWriteable:[GRXWriteable writeableWithEventHandler:^(BOOL done, id value, - NSError *error) { - if (!done) { - return; - } - if (error) { - NSLog(@"Finished with error %@", error); - } else { - NSLog(@"Finished successfully."); - } - - dispatch_time_t oneSecond = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)); - dispatch_after(oneSecond, dispatch_get_main_queue(), startCall); - }]]; - }; - - startCall(); -} -@end |