ios - How to call Magento API Login Method in Iphone -


can body tell how call login method of megnto api in iphone have done in andriod using xmlrpc library

// ... string sessionid = ""; //hashmap<string , string> params = new hashmap</string><string , string>(); //params.put("apiuser", "developer"); //params.put("apikey", "magento123"); xmlrpcclient client = new xmlrpcclient("http://some-site.com/index.php/api/xmlrpc/"); try {     /*         sessionid = (string)client.callex("login", new object[]{params});         cause         debug/my_xmlrpcexception_msg(196): xmlrpc fault: calling parameters not match signature 1     */     sessionid = (string)client.call("login", "developer", "magento123");     log.d("my_xmlrpc_success_session_id", sessionid); } catch (xmlrpcexception e) {     log.d("my_xmlrpcexception_msg", e.getmessage()); } 

i newbie iphone how can in iphone plz body can tell , library or example lead me want!!!

i got solution , using afnetworking lib git hub using using following library given in following link https://github.com/lognllc/lognmagento

some basic step

=> import lognmangento application in application

=> in magento.h - (void)settinglogin:(completionblock) completionblock;

=> in magento.m

- (void)settinglogin:(completionblock)completionblock {  standarduserdefaults = [nsuserdefaults standarduserdefaults]; array =[standarduserdefaults objectforkey:@"prefs"];  client = [[magentoclient alloc] initwithbaseurl:[nsurl urlwithstring:[array objectatindex:0]]]; [client setdefaultheader:@"soapaction" value:@"urn:mage_api_model_server_handleraction"]; [client registerhttpoperationclass:[soaprequestoperation class]]; [soaprequestoperation addacceptablestatuscodes:[nsindexset indexsetwithindexesinrange:nsmakerange(200, 301)]]; [client setdefaultheader:@"content-type" value:@"text/xml; charset=utf-8"]; [client postpath:@"login" parameters:@{@"username":[array objectatindex:1], @"apikey": [array objectatindex:2] }  success:^(afhttprequestoperation *operation, id responseobject) {     sessionid = responseobject;     completionblock(sessionid); } failure:^(afhttprequestoperation *operationdata, nserror *error) {     nslog(@"response not get");     sessionid = failed_session;     completionblock(sessionid); }];  } 

=> call in class

[magento.service settinglogin:^(nsstring *session) {             if(session){                  nslog(@"session %@",session);                 if(![session isequaltostring:@"null"])                 {                     [self.view hidetoastactivity];                     self.viewcontroller = [[viewcontroller alloc] initwithnibname:@"viewcontroller" bundle:nil];                     [self.navigationcontroller pushviewcontroller:self.viewcontroller animated:yes];                 }                 else                 {                     [self.view hidetoastactivity];                     [self.view maketoast:@"please check store info"];                     session=nil;                 }             }             else{              }         }];     }     else     {         [self.view maketoast:@"please insert data"                     duration:1.0                     position:@"bottom"                        ];     } 

and yes make change in init of magento.m in base url


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -