ios - AFNetworking not building the correct URL? -
starting ios , in need of restful networking i'm looking @ afnetworking. i've followed examples , think understand how use request gets built not have expected url. in afhttpclient requestwithmethod path parameters method,
po urlbase $0 = 0x003b23b8 https://mysite.com/developer/api (lldb) po url $1 = 0x1eddf140 /users/current -- https://mysite.com/developer/api/ (lldb) po request $2 = 0x1ed50580 <nsmutableurlrequest https://mysite.com/users/current>
the developer section getting stripped reason.
i've seen examples relative path string passed getpath method has leading slash , therefore 1 expect base url not have trailing slash i've seen examples folks put slash in both.
my base url var
nsstring *const serviceurlbaseproduction = @"https://mysite.com/developer/api/";
and relative path current user
@"/users/current";
this because of afhttpsessionmanager
's interpretation of urls. in afhttpsessionmanager.h
here there explanation of how write urls correctly. believe want current user path users/current
instead (without leading slash)
Comments
Post a Comment