ios - password with percentage symbol always wrong iPhone -



ios - password with percentage symbol always wrong iPhone -

i'm developing iphone application in xcode login function , i'm having problem next code:

nsstring *post = [nsstring stringwithformat:@"username=%@&password=%@",[nsstring stringwithformat:@"%@",username],password]; nslog(post); nsmutableurlrequest *request = [nsmutableurlrequest requestwithurl:[nsurl urlwithstring:url]]; nsdata *postdata = [post datausingencoding:nsasciistringencoding]; [request sethttpmethod:@"post"]; [request addvalue:[nsstring stringwithformat:@"%@",username] forhttpheaderfield:@"username"]; [request addvalue:password forhttpheaderfield:@"password"]; [request sethttpbody:postdata]; action = @"token"; nsurlconnection *connection; connection = [[nsurlconnection alloc] initwithrequest:request delegate:self];

now there fellow member password %32dzs3* , app gives error password incorrect. when nslog password it's indeed not password typed in textfield. looked this: 50883393zs3* . tried this:

for(int = 0; < [password length];i++){ if([password characteratindex:i] == '%'){ nsstring *temporarypw = [password substringwithrange:nsmakerange(0, i)]; password = [nsstring stringwithformat:@"%@%%%%%@",temporarypw,[password substringwithrange:nsmakerange((i+1), (password.length - -1))]]; break; } }

this returns password %%%%32dzs3* , password right when nslog it. still response wrong password response when run request. how can prepare this?

% special character in http urls. need escape before creating url, :, /, #, ;, , @. fortunately nsstring has method it.

ios objective-c iphone login

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -