objective c - RestKit - Repeat request if auth timeout -
i'm talking .net web api 2 service, using it's default "individual user accounts" authentication. i'm using restkit 0.22.0.
my issue when session timeout occurs, want have ios app re-authenticate stored credentials , replay request. way i've found like this - asked year ago. not think answer should check if status code 401, re-authenticate, retry request in every failure block. that's lot of copy , pasting!
is there better way accomplish want?
call common method failure block takes required inputs. preferably might want have multiple common methods capable of verifying response details , restarting process automatically (so 1 get, 1 post, ...).
pseudo code
- (void)do info: { ... calculate method specifics call general method ... [self getobjectsatpath:urlarg parameters:p success:s]; } - (void)getobjectsatpath:urlarg parameters:p success:s { [rk getobjectsatpath:urlarg parameters:nil success: { -- yay -- call success callback s(); } failure: { -- humph -- retry ... auth updates, retry ... [self getobjectsatpath:urlarg parameters:p success:s]; } }
Comments
Post a Comment