aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/objective-c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/objective-c')
-rw-r--r--examples/objective-c/route_guide/Misc/Base.lproj/Main.storyboard108
-rw-r--r--examples/objective-c/route_guide/ViewControllers.m41
2 files changed, 102 insertions, 47 deletions
diff --git a/examples/objective-c/route_guide/Misc/Base.lproj/Main.storyboard b/examples/objective-c/route_guide/Misc/Base.lproj/Main.storyboard
index 9bf9498d62..306320f7d8 100644
--- a/examples/objective-c/route_guide/Misc/Base.lproj/Main.storyboard
+++ b/examples/objective-c/route_guide/Misc/Base.lproj/Main.storyboard
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="7702" systemVersion="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="49e-Tb-3d3">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="49e-Tb-3d3">
<dependencies>
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
+ <deployment identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--Get Feature-->
@@ -16,33 +17,35 @@
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
- <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" text="Get Feature Demo" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="KQZ-1w-vlD">
- <rect key="frame" x="150" y="279" width="299" height="42"/>
- <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
- <fontDescription key="fontDescription" name="Helvetica" family="Helvetica" pointSize="36"/>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" misplaced="YES" text="Execution log:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="au7-AW-5ov">
+ <rect key="frame" x="16" y="0.0" width="257" height="61"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
- <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="See ViewControllers.m and this app's log in XCode" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="A5M-7J-77L">
- <rect key="frame" x="136" y="329" width="329" height="17"/>
- <fontDescription key="fontDescription" type="system" pointSize="14"/>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2ga-Gd-X9q">
+ <rect key="frame" x="20" y="82" width="560" height="437"/>
+ <accessibility key="accessibilityConfiguration">
+ <accessibilityTraits key="traits" link="YES"/>
+ </accessibility>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
- <constraint firstAttribute="centerX" secondItem="KQZ-1w-vlD" secondAttribute="centerX" id="6BV-lF-sBN"/>
- <constraint firstItem="A5M-7J-77L" firstAttribute="top" secondItem="KQZ-1w-vlD" secondAttribute="bottom" constant="8" symbolic="YES" id="cfb-er-3JN"/>
- <constraint firstItem="A5M-7J-77L" firstAttribute="centerX" secondItem="KQZ-1w-vlD" secondAttribute="centerX" id="e1l-AV-tCB"/>
- <constraint firstAttribute="centerY" secondItem="KQZ-1w-vlD" secondAttribute="centerY" id="exm-UA-ej4"/>
+ <constraint firstItem="au7-AW-5ov" firstAttribute="centerX" secondItem="tsR-hK-woN" secondAttribute="centerX" constant="20" id="JAX-zf-Z1I"/>
</constraints>
</view>
<tabBarItem key="tabBarItem" title="Get Feature" image="first" id="acW-dT-cKf"/>
+ <connections>
+ <outlet property="output_label" destination="2ga-Gd-X9q" id="yXF-xa-kbD"/>
+ </connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="W5J-7L-Pyd" sceneMemberID="firstResponder"/>
</objects>
- <point key="canvasLocation" x="718" y="-660"/>
+ <point key="canvasLocation" x="733" y="-653"/>
</scene>
<!--List Features-->
<scene sceneID="wg7-f3-ORb">
@@ -56,29 +59,35 @@
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
- <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" text="List Features Demo" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="zEq-FU-wV5">
- <rect key="frame" x="143" y="279" width="315" height="42"/>
- <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
- <fontDescription key="fontDescription" name="Helvetica" family="Helvetica" pointSize="36"/>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8mE-gq-NQc">
+ <rect key="frame" x="20" y="114" width="560" height="437"/>
+ <accessibility key="accessibilityConfiguration">
+ <accessibilityTraits key="traits" link="YES"/>
+ </accessibility>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
- <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="See ViewControllers.m and this app's log in XCode" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NDk-cv-Gan">
- <rect key="frame" x="136" y="329" width="329" height="17"/>
- <fontDescription key="fontDescription" type="system" pointSize="14"/>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" misplaced="YES" text="Execution log:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DbB-M0-xs2">
+ <rect key="frame" x="50" y="12" width="257" height="61"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ <accessibility key="accessibilityConfiguration">
+ <accessibilityTraits key="traits" staticText="YES"/>
+ </accessibility>
<constraints>
- <constraint firstItem="NDk-cv-Gan" firstAttribute="top" secondItem="zEq-FU-wV5" secondAttribute="bottom" constant="8" symbolic="YES" id="Day-4N-Vmt"/>
- <constraint firstItem="NDk-cv-Gan" firstAttribute="centerX" secondItem="zEq-FU-wV5" secondAttribute="centerX" id="JgO-Fn-dHn"/>
- <constraint firstAttribute="centerX" secondItem="zEq-FU-wV5" secondAttribute="centerX" id="qqM-NS-xev"/>
- <constraint firstAttribute="centerY" secondItem="zEq-FU-wV5" secondAttribute="centerY" id="qzY-Ky-pLD"/>
+ <constraint firstItem="DbB-M0-xs2" firstAttribute="centerX" secondItem="QS5-Rx-YEW" secondAttribute="centerX" constant="20" id="UDo-WG-7i3"/>
+ <constraint firstItem="DbB-M0-xs2" firstAttribute="centerX" secondItem="QS5-Rx-YEW" secondAttribute="centerX" constant="20" id="W7v-LC-HjP"/>
</constraints>
</view>
<tabBarItem key="tabBarItem" title="List Features" image="second" id="cPa-gy-q4n"/>
+ <connections>
+ <outlet property="output_label" destination="8mE-gq-NQc" id="6rw-Kd-21X"/>
+ </connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="4Nw-L8-lE0" sceneMemberID="firstResponder"/>
</objects>
@@ -117,29 +126,32 @@
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
- <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" text="Record Route Demo" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="Nqv-Vr-o8P">
- <rect key="frame" x="136" y="279" width="329" height="42"/>
- <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
- <fontDescription key="fontDescription" name="Helvetica" family="Helvetica" pointSize="36"/>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" misplaced="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9wL-iS-tp8">
+ <rect key="frame" x="20" y="114" width="560" height="437"/>
+ <accessibility key="accessibilityConfiguration">
+ <accessibilityTraits key="traits" link="YES"/>
+ </accessibility>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
- <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="See ViewControllers.m and this app's log in XCode" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xjS-0N-tLe">
- <rect key="frame" x="136" y="329" width="329" height="17"/>
- <fontDescription key="fontDescription" type="system" pointSize="14"/>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" misplaced="YES" text="Execution log:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5qv-tY-qxl">
+ <rect key="frame" x="30" y="10" width="257" height="61"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
- <constraint firstAttribute="centerX" secondItem="Nqv-Vr-o8P" secondAttribute="centerX" id="1wf-uc-57y"/>
- <constraint firstItem="xjS-0N-tLe" firstAttribute="centerX" secondItem="Nqv-Vr-o8P" secondAttribute="centerX" id="Gnh-rN-EQ3"/>
- <constraint firstItem="xjS-0N-tLe" firstAttribute="top" secondItem="Nqv-Vr-o8P" secondAttribute="bottom" constant="8" symbolic="YES" id="Xhj-u3-th9"/>
- <constraint firstAttribute="centerY" secondItem="Nqv-Vr-o8P" secondAttribute="centerY" id="xqU-v8-Bb3"/>
+ <constraint firstItem="9wL-iS-tp8" firstAttribute="centerX" secondItem="Wvj-mg-YnO" secondAttribute="centerX" constant="20" id="7TX-Jm-662"/>
+ <constraint firstItem="5qv-tY-qxl" firstAttribute="centerX" secondItem="Wvj-mg-YnO" secondAttribute="centerX" id="mRS-9u-c2a"/>
</constraints>
</view>
<tabBarItem key="tabBarItem" title="Record Route" image="first" id="PLK-Jm-UyM"/>
+ <connections>
+ <outlet property="output_label" destination="9wL-iS-tp8" id="xhd-zm-66g"/>
+ </connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="9RW-dt-a4q" sceneMemberID="firstResponder"/>
</objects>
@@ -157,29 +169,31 @@
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
- <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" text="Route Chat Demo" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="zUL-Bo-wJt">
- <rect key="frame" x="156" y="279" width="289" height="42"/>
- <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
- <fontDescription key="fontDescription" name="Helvetica" family="Helvetica" pointSize="36"/>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" misplaced="YES" text="Execution log:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BxD-G9-xhU">
+ <rect key="frame" x="20" y="10" width="257" height="61"/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
- <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="See ViewControllers.m and this app's log in XCode" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CgS-1q-Od9">
- <rect key="frame" x="136" y="329" width="329" height="17"/>
- <fontDescription key="fontDescription" type="system" pointSize="14"/>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="131-U2-Ogk">
+ <rect key="frame" x="20" y="114" width="560" height="437"/>
+ <accessibility key="accessibilityConfiguration">
+ <accessibilityTraits key="traits" link="YES"/>
+ </accessibility>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
- <constraint firstAttribute="centerY" secondItem="zUL-Bo-wJt" secondAttribute="centerY" id="5hM-q1-ZjM"/>
- <constraint firstItem="CgS-1q-Od9" firstAttribute="top" secondItem="zUL-Bo-wJt" secondAttribute="bottom" constant="8" symbolic="YES" id="AqI-Ra-a5O"/>
- <constraint firstItem="CgS-1q-Od9" firstAttribute="centerX" secondItem="zUL-Bo-wJt" secondAttribute="centerX" id="K8f-KI-bc6"/>
- <constraint firstAttribute="centerX" secondItem="zUL-Bo-wJt" secondAttribute="centerX" id="n8b-x8-Yze"/>
+ <constraint firstItem="BxD-G9-xhU" firstAttribute="centerX" secondItem="c9d-af-OMP" secondAttribute="centerX" id="wSw-7t-wxX"/>
</constraints>
</view>
<tabBarItem key="tabBarItem" title="Route Chat" image="second" id="p2G-IC-yAR"/>
+ <connections>
+ <outlet property="output_label" destination="131-U2-Ogk" id="fNw-M5-x1D"/>
+ </connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="yUz-se-Cfi" sceneMemberID="firstResponder"/>
</objects>
diff --git a/examples/objective-c/route_guide/ViewControllers.m b/examples/objective-c/route_guide/ViewControllers.m
index e32978240b..b916a4ee0c 100644
--- a/examples/objective-c/route_guide/ViewControllers.m
+++ b/examples/objective-c/route_guide/ViewControllers.m
@@ -83,6 +83,7 @@ static NSString * const kHostAddress = @"localhost:50051";
@interface GetFeatureViewController : UIViewController {
RTGRouteGuide *service;
}
+@property (weak, nonatomic) IBOutlet UILabel *output_label;
@end
@implementation GetFeatureViewController
@@ -90,10 +91,16 @@ static NSString * const kHostAddress = @"localhost:50051";
- (void)execRequest {
void (^handler)(RTGFeature *response, NSError *error) = ^(RTGFeature *response, NSError *error) {
if (response.name.length) {
+ NSString *str =[NSString stringWithFormat:@"%@\nFound feature called %@ at %@.", self.output_label.text, response.location, response.name];
+ self.output_label.text = str;
NSLog(@"Found feature called %@ at %@.", response.name, response.location);
} else if (response) {
+ NSString *str =[NSString stringWithFormat:@"%@\nFound no features at %@", self.output_label.text,response.location];
+ self.output_label.text = str;
NSLog(@"Found no features at %@", response.location);
} else {
+ NSString *str =[NSString stringWithFormat:@"%@\nRPC error: %@", self.output_label.text, error];
+ self.output_label.text = str;
NSLog(@"RPC error: %@", error);
}
};
@@ -116,6 +123,9 @@ static NSString * const kHostAddress = @"localhost:50051";
}
- (void)viewDidAppear:(BOOL)animated {
+ self.output_label.text = @"RPC log:";
+ self.output_label.numberOfLines = 0;
+ self.output_label.font = [UIFont fontWithName:@"Helvetica Neue" size:8.0];
[self execRequest];
}
@@ -131,6 +141,7 @@ static NSString * const kHostAddress = @"localhost:50051";
@interface ListFeaturesViewController : UIViewController {
RTGRouteGuide *service;
}
+@property (weak, nonatomic) IBOutlet UILabel *output_label;
@end
@@ -147,8 +158,12 @@ static NSString * const kHostAddress = @"localhost:50051";
[service listFeaturesWithRequest:rectangle
eventHandler:^(BOOL done, RTGFeature *response, NSError *error) {
if (response) {
+ NSString *str =[NSString stringWithFormat:@"%@\nFound feature at %@ called %@.", self.output_label.text, response.location, response.name];
+ self.output_label.text = str;
NSLog(@"Found feature at %@ called %@.", response.location, response.name);
} else if (error) {
+ NSString *str =[NSString stringWithFormat:@"%@\nRPC error: %@", self.output_label.text, error];
+ self.output_label.text = str;
NSLog(@"RPC error: %@", error);
}
}];
@@ -161,6 +176,9 @@ static NSString * const kHostAddress = @"localhost:50051";
}
- (void)viewDidAppear:(BOOL)animated {
+ self.output_label.text = @"RPC log:";
+ self.output_label.numberOfLines = 0;
+ self.output_label.font = [UIFont fontWithName:@"Helvetica Neue" size:8.0];
[self execRequest];
}
@@ -177,6 +195,7 @@ static NSString * const kHostAddress = @"localhost:50051";
@interface RecordRouteViewController : UIViewController {
RTGRouteGuide *service;
}
+@property (weak, nonatomic) IBOutlet UILabel *output_label;
@end
@@ -192,6 +211,8 @@ static NSString * const kHostAddress = @"localhost:50051";
RTGPoint *location = [RTGPoint message];
location.longitude = [((NSNumber *) feature[@"location"][@"longitude"]) intValue];
location.latitude = [((NSNumber *) feature[@"location"][@"latitude"]) intValue];
+ NSString *str =[NSString stringWithFormat:@"%@\nVisiting point %@", self.output_label.text, location];
+ self.output_label.text = str;
NSLog(@"Visiting point %@", location);
return location;
}];
@@ -199,11 +220,19 @@ static NSString * const kHostAddress = @"localhost:50051";
[service recordRouteWithRequestsWriter:locations
handler:^(RTGRouteSummary *response, NSError *error) {
if (response) {
+ NSString *str =[NSString stringWithFormat:
+ @"%@\nFinished trip with %i points\nPassed %i features\n"
+ "Travelled %i meters\nIt took %i seconds",
+ self.output_label.text, response.pointCount, response.featureCount,
+ response.distance, response.elapsedTime];
+ self.output_label.text = str;
NSLog(@"Finished trip with %i points", response.pointCount);
NSLog(@"Passed %i features", response.featureCount);
NSLog(@"Travelled %i meters", response.distance);
NSLog(@"It took %i seconds", response.elapsedTime);
} else {
+ NSString *str =[NSString stringWithFormat:@"%@\nRPC error: %@", self.output_label.text, error];
+ self.output_label.text = str;
NSLog(@"RPC error: %@", error);
}
}];
@@ -216,6 +245,9 @@ static NSString * const kHostAddress = @"localhost:50051";
}
- (void)viewDidAppear:(BOOL)animated {
+ self.output_label.text = @"RPC log:";
+ self.output_label.numberOfLines = 0;
+ self.output_label.font = [UIFont fontWithName:@"Helvetica Neue" size:8.0];
[self execRequest];
}
@@ -231,6 +263,7 @@ static NSString * const kHostAddress = @"localhost:50051";
@interface RouteChatViewController : UIViewController {
RTGRouteGuide *service;
}
+@property (weak, nonatomic) IBOutlet UILabel *output_label;
@end
@@ -249,8 +282,13 @@ static NSString * const kHostAddress = @"localhost:50051";
[service routeChatWithRequestsWriter:notesWriter
eventHandler:^(BOOL done, RTGRouteNote *note, NSError *error) {
if (note) {
+ NSString *str =[NSString stringWithFormat:@"%@\nGot message %@ at %@",
+ self.output_label.text, note.message, note.location];
+ self.output_label.text = str;
NSLog(@"Got message %@ at %@", note.message, note.location);
} else if (error) {
+ NSString *str =[NSString stringWithFormat:@"%@\nRPC error: %@", self.output_label.text, error];
+ self.output_label.text = str;
NSLog(@"RPC error: %@", error);
}
if (done) {
@@ -266,6 +304,9 @@ static NSString * const kHostAddress = @"localhost:50051";
}
- (void)viewDidAppear:(BOOL)animated {
+ self.output_label.text = @"RPC log:";
+ self.output_label.numberOfLines = 0;
+ self.output_label.font = [UIFont fontWithName:@"Helvetica Neue" size:8.0];
[self execRequest];
}