diff options
Diffstat (limited to 'objective-c/helloworld')
-rw-r--r-- | objective-c/helloworld/HelloWorld.podspec | 2 | ||||
-rw-r--r-- | objective-c/helloworld/HelloWorld.xcodeproj/project.pbxproj | 131 | ||||
-rw-r--r-- | objective-c/helloworld/HelloWorld/AppDelegate.h | 3 | ||||
-rw-r--r-- | objective-c/helloworld/HelloWorld/AppDelegate.m | 1 | ||||
-rw-r--r-- | objective-c/helloworld/HelloWorld/ViewController.h | 40 | ||||
-rw-r--r-- | objective-c/helloworld/HelloWorld/ViewController.m | 6 | ||||
-rw-r--r-- | objective-c/helloworld/README.md | 26 |
7 files changed, 21 insertions, 188 deletions
diff --git a/objective-c/helloworld/HelloWorld.podspec b/objective-c/helloworld/HelloWorld.podspec index 744debb577..ae009a688c 100644 --- a/objective-c/helloworld/HelloWorld.podspec +++ b/objective-c/helloworld/HelloWorld.podspec @@ -29,7 +29,7 @@ Pod::Spec.new do |s| ss.source_files = "#{dir}/*.pbrpc.{h,m}", "#{dir}/**/*.pbrpc.{h,m}" ss.header_mappings_dir = dir ss.requires_arc = true - ss.dependency "gRPC", "~> 0.5" + ss.dependency "gRPC", "~> 0.6" ss.dependency "#{s.name}/Messages" end end diff --git a/objective-c/helloworld/HelloWorld.xcodeproj/project.pbxproj b/objective-c/helloworld/HelloWorld.xcodeproj/project.pbxproj index 8d92247a91..702ad3ff8b 100644 --- a/objective-c/helloworld/HelloWorld.xcodeproj/project.pbxproj +++ b/objective-c/helloworld/HelloWorld.xcodeproj/project.pbxproj @@ -12,20 +12,9 @@ 5E36906C1B2A23800040F884 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E36906B1B2A23800040F884 /* ViewController.m */; }; 5E36906F1B2A23800040F884 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5E36906D1B2A23800040F884 /* Main.storyboard */; }; 5E3690711B2A23800040F884 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5E3690701B2A23800040F884 /* Images.xcassets */; }; - 5E3690801B2A23800040F884 /* HelloWorldTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5E36907F1B2A23800040F884 /* HelloWorldTests.m */; }; EF61CF6AE2536A31D47F0E63 /* libPods-HelloWorld.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B4E1F55F8A2EC95A0E7EE88 /* libPods-HelloWorld.a */; }; /* End PBXBuildFile section */ -/* Begin PBXContainerItemProxy section */ - 5E36907A1B2A23800040F884 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 5E3690581B2A23800040F884 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 5E36905F1B2A23800040F884; - remoteInfo = HelloWorld; - }; -/* End PBXContainerItemProxy section */ - /* Begin PBXFileReference section */ 0C432EF610DB15C0F47A66BB /* Pods-HelloWorld.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HelloWorld.release.xcconfig"; path = "Pods/Target Support Files/Pods-HelloWorld/Pods-HelloWorld.release.xcconfig"; sourceTree = "<group>"; }; 5E3690601B2A23800040F884 /* HelloWorld.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloWorld.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -33,13 +22,9 @@ 5E3690651B2A23800040F884 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; 5E3690671B2A23800040F884 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; 5E3690681B2A23800040F884 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; - 5E36906A1B2A23800040F884 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; }; 5E36906B1B2A23800040F884 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; }; 5E36906E1B2A23800040F884 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; 5E3690701B2A23800040F884 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; }; - 5E3690791B2A23800040F884 /* HelloWorldTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HelloWorldTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 5E36907E1B2A23800040F884 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; - 5E36907F1B2A23800040F884 /* HelloWorldTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HelloWorldTests.m; sourceTree = "<group>"; }; 6B4E1F55F8A2EC95A0E7EE88 /* libPods-HelloWorld.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-HelloWorld.a"; sourceTree = BUILT_PRODUCTS_DIR; }; DBDE3E48389499064CD664B8 /* Pods-HelloWorld.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HelloWorld.debug.xcconfig"; path = "Pods/Target Support Files/Pods-HelloWorld/Pods-HelloWorld.debug.xcconfig"; sourceTree = "<group>"; }; /* End PBXFileReference section */ @@ -53,13 +38,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 5E3690761B2A23800040F884 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -68,7 +46,6 @@ children = ( 5E3690651B2A23800040F884 /* main.m */, 5E3690621B2A23800040F884 /* HelloWorld */, - 5E36907C1B2A23800040F884 /* HelloWorldTests */, 5E3690611B2A23800040F884 /* Products */, BD9CE6458E7C4FF49A1DF69F /* Pods */, 66CEC7120220DDD2221DD075 /* Frameworks */, @@ -79,7 +56,6 @@ isa = PBXGroup; children = ( 5E3690601B2A23800040F884 /* HelloWorld.app */, - 5E3690791B2A23800040F884 /* HelloWorldTests.xctest */, ); name = Products; sourceTree = "<group>"; @@ -98,7 +74,6 @@ 5E3690701B2A23800040F884 /* Images.xcassets */, 5E36906D1B2A23800040F884 /* Main.storyboard */, 5E36906B1B2A23800040F884 /* ViewController.m */, - 5E36906A1B2A23800040F884 /* ViewController.h */, 5E3690681B2A23800040F884 /* AppDelegate.m */, 5E3690671B2A23800040F884 /* AppDelegate.h */, 5E3690641B2A23800040F884 /* Info.plist */, @@ -106,23 +81,6 @@ name = "Supporting Files"; sourceTree = "<group>"; }; - 5E36907C1B2A23800040F884 /* HelloWorldTests */ = { - isa = PBXGroup; - children = ( - 5E36907F1B2A23800040F884 /* HelloWorldTests.m */, - 5E36907D1B2A23800040F884 /* Supporting Files */, - ); - path = HelloWorldTests; - sourceTree = "<group>"; - }; - 5E36907D1B2A23800040F884 /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 5E36907E1B2A23800040F884 /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = "<group>"; - }; 66CEC7120220DDD2221DD075 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -162,24 +120,6 @@ productReference = 5E3690601B2A23800040F884 /* HelloWorld.app */; productType = "com.apple.product-type.application"; }; - 5E3690781B2A23800040F884 /* HelloWorldTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 5E3690861B2A23810040F884 /* Build configuration list for PBXNativeTarget "HelloWorldTests" */; - buildPhases = ( - 5E3690751B2A23800040F884 /* Sources */, - 5E3690761B2A23800040F884 /* Frameworks */, - 5E3690771B2A23800040F884 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 5E36907B1B2A23800040F884 /* PBXTargetDependency */, - ); - name = HelloWorldTests; - productName = HelloWorldTests; - productReference = 5E3690791B2A23800040F884 /* HelloWorldTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -192,10 +132,6 @@ 5E36905F1B2A23800040F884 = { CreatedOnToolsVersion = 6.2; }; - 5E3690781B2A23800040F884 = { - CreatedOnToolsVersion = 6.2; - TestTargetID = 5E36905F1B2A23800040F884; - }; }; }; buildConfigurationList = 5E36905B1B2A23800040F884 /* Build configuration list for PBXProject "HelloWorld" */; @@ -212,7 +148,6 @@ projectRoot = ""; targets = ( 5E36905F1B2A23800040F884 /* HelloWorld */, - 5E3690781B2A23800040F884 /* HelloWorldTests */, ); }; /* End PBXProject section */ @@ -227,13 +162,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 5E3690771B2A23800040F884 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -280,24 +208,8 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 5E3690751B2A23800040F884 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 5E3690801B2A23800040F884 /* HelloWorldTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXSourcesBuildPhase section */ -/* Begin PBXTargetDependency section */ - 5E36907B1B2A23800040F884 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 5E36905F1B2A23800040F884 /* HelloWorld */; - targetProxy = 5E36907A1B2A23800040F884 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - /* Begin PBXVariantGroup section */ 5E36906D1B2A23800040F884 /* Main.storyboard */ = { isa = PBXVariantGroup; @@ -410,40 +322,6 @@ }; name = Release; }; - 5E3690871B2A23810040F884 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = HelloWorldTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/HelloWorld.app/HelloWorld"; - }; - name = Debug; - }; - 5E3690881B2A23810040F884 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); - INFOPLIST_FILE = HelloWorldTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/HelloWorld.app/HelloWorld"; - }; - name = Release; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -465,15 +343,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 5E3690861B2A23810040F884 /* Build configuration list for PBXNativeTarget "HelloWorldTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 5E3690871B2A23810040F884 /* Debug */, - 5E3690881B2A23810040F884 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; /* End XCConfigurationList section */ }; rootObject = 5E3690581B2A23800040F884 /* Project object */; diff --git a/objective-c/helloworld/HelloWorld/AppDelegate.h b/objective-c/helloworld/HelloWorld/AppDelegate.h index b1857f28e0..102e7f3ade 100644 --- a/objective-c/helloworld/HelloWorld/AppDelegate.h +++ b/objective-c/helloworld/HelloWorld/AppDelegate.h @@ -34,8 +34,5 @@ #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> - @property (strong, nonatomic) UIWindow *window; - @end - diff --git a/objective-c/helloworld/HelloWorld/AppDelegate.m b/objective-c/helloworld/HelloWorld/AppDelegate.m index 27b1f00f98..a38e36651e 100644 --- a/objective-c/helloworld/HelloWorld/AppDelegate.m +++ b/objective-c/helloworld/HelloWorld/AppDelegate.m @@ -34,5 +34,4 @@ #import "AppDelegate.h" @implementation AppDelegate - @end diff --git a/objective-c/helloworld/HelloWorld/ViewController.h b/objective-c/helloworld/HelloWorld/ViewController.h deleted file mode 100644 index 38cd7f92b6..0000000000 --- a/objective-c/helloworld/HelloWorld/ViewController.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#import <UIKit/UIKit.h> - -@interface ViewController : UIViewController - - -@end - diff --git a/objective-c/helloworld/HelloWorld/ViewController.m b/objective-c/helloworld/HelloWorld/ViewController.m index 91df435ed9..090fd93689 100644 --- a/objective-c/helloworld/HelloWorld/ViewController.m +++ b/objective-c/helloworld/HelloWorld/ViewController.m @@ -31,8 +31,10 @@ * */ -#import "ViewController.h" +#import <UIKit/UIKit.h> -@implementation ViewController +@interface ViewController : UIViewController +@end +@implementation ViewController @end diff --git a/objective-c/helloworld/README.md b/objective-c/helloworld/README.md index 8f6d0d3a8d..685339e84a 100644 --- a/objective-c/helloworld/README.md +++ b/objective-c/helloworld/README.md @@ -2,15 +2,17 @@ ## Installation -To run this example you should have [Cocoapods](https://cocoapods.org/#install) installed, as well as the relevant tools to generate the client library code (and a server in another language, for testing). You can obtain the latter by following [these setup instructions](https://github.com/grpc/homebrew-grpc). +To run this example you should have [Cocoapods](https://cocoapods.org/#install) installed, as well +as the relevant tools to generate the client library code (and a server in another language, for +testing). You can obtain the latter by following [these setup instructions](https://github.com/grpc/homebrew-grpc). ## Hello Objective-C gRPC! -Here's how to build and run the Objective-C implementation of the [Hello World](https://github.com/grpc/grpc-common/blob/master/protos/helloworld.proto) example used in [Getting started](https://github.com/grpc/grpc-common). +Here's how to build and run the Objective-C implementation of the [Hello World](https://github.com/grpc/grpc-common/blob/master/protos/helloworld.proto) +example used in [Getting started](https://github.com/grpc/grpc-common). -The example code for this and our other examples lives in the `grpc-common` -GitHub repository. Clone this repository to your local machine by running the -following command: +The example code for this and our other examples lives in the `grpc-common` GitHub repository. Clone +this repository to your local machine by running the following command: ```sh @@ -24,7 +26,8 @@ $ cd grpc-common/objective-c/helloworld ``` ### Try it! -To try the sample app, we need a gRPC server running locally. Let's compile and run, for example, the C++ server in this repository: +To try the sample app, we need a gRPC server running locally. Let's compile and run, for example, +the C++ server in this repository: ```shell $ pushd ../../cpp/helloworld @@ -39,12 +42,15 @@ Now have Cocoapods generate and install the client library for our .proto files: $ pod install ``` -This might have to compile OpenSSL, which takes around 15 minutes if Cocoapods doesn't have it yet on your computer's cache). +(This might have to compile OpenSSL, which takes around 15 minutes if Cocoapods doesn't have it yet +on your computer's cache.) -Finally, open the XCode workspace created by Cocoapods, and run the app. You can check the calling code in `main.m` and see the results in XCode's log console. +Finally, open the XCode workspace created by Cocoapods, and run the app. You can check the calling +code in `main.m` and see the results in XCode's log console. -The code sends a `HLWHelloRequest` containing the string "Objective-C" to a local server. The server responds with a `HLWHelloResponse`, which contains a string that is then output to the log. +The code sends a `HLWHelloRequest` containing the string "Objective-C" to a local server. The server +responds with a `HLWHelloResponse`, which contains a string that is then output to the log. ## Tutorial -You can find a more detailed tutorial in [gRPC Basics: Objective-C](https://github.com/grpc/grpc-common/blob/master/objective-c/route_guide/README.md)
\ No newline at end of file +You can find a more detailed tutorial in [gRPC Basics: Objective-C](https://github.com/grpc/grpc-common/blob/master/objective-c/route_guide/README.md). |