List of all Iphone and Blackberry Development codes in a one click Iphone,objective C,xcode,blackberry Development,iOS Development

Wednesday, May 8, 2019

ios Objectice C API Calling Custom Class

Login.h class

#import <UIKit/UIKit.h>
#import "API_Services.h"

@interface ViewController : UIViewController<UITextFieldDelegate,APIServicesListener>
{
UITextField *emailTextField,*passwordTextField;
}
@property (strong, nonatomic) UIWindow *window;



@end


 Login.m Class
 On Login Button Call the Below to hit the API Call

  [[API_Services sharedInstance]login:emailTextField.text password:passwordTextField.text andListener:self];

Callback---

-(void)APIServicesResult:(NSString *) success withResult:(NSDictionary *)result statusCode:(NSString *)statusCode headerFields:(NSDictionary *)headerFields{
[load hideView];
// Util *util = [[Util alloc]init];
NSLog(@"result----------->%@",result);
if([statusCode isEqualToString:@"200"]){
BOOL successFail=[[result objectForKey:@"Status"] boolValue];
if(successFail){
}
else {
NSString *errMsg;
if([result objectForKey:@"message"]){
errMsg=[result objectForKey:@"message"];
}else{
errMsg=[result objectForKey:@"Error"];
}
[self alertViewShow:errMsg];
}
}
else if([statusCode isEqualToString:@"1"]){
[self alertViewShow:STRING_No_Network_ERROR];
}
}




ZIP File