I want to use a protocol, how can we implement it in iPhone.
///In POCViewController.h
#import
@protocol BasicAPI
-(NSString*)hello;
@end
@interface HessianPOCViewController : UIViewController
{
idbasicAPI;}
@end
///
// In POCViewController.m
// In Some methodNSURL* url = [NSURL
URLWithString@”http://www.caucho.com/hessian/test/basic“];id proxy =
(id)[CWHessianConnection
proxyWithURL:url
protocol:@protocol(basicAPI)];NSLog(@”hello: %@”, [proxy hello]);
////
Please help me how I can implement above code?
In the above code snippet – the @protocol block goes in your header file, underneath the @end declaration that’s already there. Common use case is something like:
Then in some method body in your implementation file, MyClass.m