POST SERVICE HELPER
Keywords: Post service, HTTP, Helper
Helper classes download at http://adf.ly/ILKC0
1) Get the helper classes for post service from here. This helper class provides asynchronous request.
2) Methods provided by helper classes
-(void)setURL:(NSString *)str;
-(void)addParamValue:(NSString *)value forKey:(NSString *)key;
-(void)addHeaderValue:(NSString *)value forKey:(NSString *)key;
-(void)runWithController:(UIViewController *)ctrl andCallBack:(SEL)select;
Use of helper classes
i) import Post service helper class where do you want to use post service
#import "PostServiceHelper.h"
ii) Initialise object of PostServiceHelper as
PostServiceHelper *helper=[[PostServiceHelper alloc]init];
iii) set URL as
[helper setURL:urlString];
// url string is your url where do you want to send request.
iv) set Header as
[helper addHeaderValue:value forKey:key];
// value and key are NSString
v) set Parameter as
[helper addParamValue:value forKey:key];
// value and key are NSString
vi) Run service
[helper runWithController:self andCallBack:@selector(callback:)];
// callback: is a callback method
vii) You can use call back method as
-(void)callback:(NSString *)result
{
NSLog(@"%@", result);
// Here we are printing response , You can use this result as you want
}
You can get the source file from here
No comments:
Post a Comment