Skip to content

Instantly share code, notes, and snippets.

@pieceable
Created June 8, 2010 21:42
Show Gist options
  • Save pieceable/430695 to your computer and use it in GitHub Desktop.
Save pieceable/430695 to your computer and use it in GitHub Desktop.
- (void)addSomeNumbers
{
var num1 = 1;
var num2 = 2;
[[self thriftClient] addWithNum1:num1
num2:num2
target:self
successAction:@selector(thriftClient:addSucceeded:)
failureAction:@selector(thriftClient:addFailed:)];
}
- (void)thriftClient:(CalculatorClient)thriftClient addSucceeded:(int)sum
{
CPLog.info("Added succeeded with sum: " + sum);
}
- (void)thriftClient:(CalculatorClient)thriftClient addFailed:(id)error
{
CPLog.info("Added failed with error: " + error);
}
- (id)thriftClient
{
var transport = [[THTTPTransport alloc] initWithURL:"http://localhost:4567/thrift"];
var protocol = [[TBinaryProtocol alloc] initWithTransport:transport];
var client = [[CalculatorClient alloc] initWithProtocol:protocol];
return client;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment