ios - Issue while setting HTTP header through AFNetwokring -


problem:

- (void) getreportsummarywithcompletionblock:(void (^)(bool success))success {          nsstring *storedtoken = [[user shareduser] accesstoken];         nslog(@"stored class: %@",[storedtoken class]);         //logs -- __nscfstring         nsstring *constanttoken = @"e5c47aa3-c168-480b-a10c-1c4379096fbf";         nslog(@"constant class: %@",[constanttoken class]);         //logs -- __nscfconstantstring         [self.manager.requestserializer setvalue:constanttoken forhttpheaderfield:@"authorization"];         //[self.manager.requestserializer setvalue:storedtoken forhttpheaderfield:@"authorization"];          [self.manager get:someurlstring parameters:nil success:^(afhttprequestoperation *operation, id responseobject) {             nslog(@"%@",responseobject);             success(yes);         } failure:^(afhttprequestoperation *operation, nserror *error) {             success(no);         }]; 

when log value of storedtoken prints "e5c47aa3-c168-480b-a10c-1c4379096fbf"

and constanttoken prints e5c47aa3-c168-480b-a10c-1c4379096fbf withtout ".

when use constanttoken server responds correctly when use storedtoken server reponse not correct.

question:

now there workaround issue? anyway cast nscfstring nscfconstantstring ?

thanks in advance :).

you storing storedtoken @"\"xxx-yyy-zzz-bla-bla\"" please save correctly or ask server send string without double quotes

for time being can trim ", can replace " empty sting won't recommend that

nsstring *goodtoken = [storedtoken stringbytrimmingcharactersinset:[nscharacterset charactersetwithcharactersinstring:@"\""]]; nslog(@"%@", goodtoken); 


p.s.

this should seen temporary fix, should save token don't have double quotes. please onto code , find why you're getting double quotes, might server sending string double quotes.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -