iOS Implementation Login Verification

Source: Internet
Author: User

We can use the third frame afnetworkingto communicate with the server usingits post method. If the server returns a userId of ten , it succeeds, and the returned one represents either a user name or a password error.

<span style= "FONT-SIZE:14PX;" >-(void) login: (ID) sender{      afhttprequestoperationmanager *manager=[ Afhttprequestoperationmanager manager];    nsstring *[email protected] "http ://172.18.144.248:8080/upload_file_service/loginservlet ";     manager.responseserializer.acceptablecontenttypes=[nsset setwithobjects:@ "Text/html",nil];      nsdictionary *[email protected]{@ "user": @ "admin" @ "pass": @ "123"};     [manager post:url parameters:namepwd success:^ (afhttprequestoperation * Operation, id responseobject)  {     nslog (@ "post-->%@", Responseobject);     nsdictionary *datare=[[nsdictionary alloc] init];      datare=responseobject;        re=[datare  objectforkey:@ "UserId"];     appstatus *transvalue=[appstatus shareinstance];      mainviewcontroller *mainview=[self.storyboard instantiateviewcontrollerwithidentifier:@ "Second "];     mainview.delegate=self;     transvalue.contextstr=__ name.text;     nsnumber *fre=[[nsnumber alloc]initwithint:10];      BOOL flag=[fre isEqualToNumber:re];     if (flag) {               [self presentviewcontroller: mainview animated:yes completion:nil];        }     } failure:^ (Afhttprequestoperation *operation, nserror *error)  {         nslog (@ "%@", @ "username or password error");    }];    }</span>


iOS Implementation Login Verification

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.