Sunday, January 13, 2013

iPhone Post Web Service Helper


Keywords: Post service, HTTP, Helper

Get contacts of all your emergency needs on single tap. Download Quick-Finder for iPhone

Helper classes download at

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