FatFractal customer forums

Author Topic: resetPassword() and expired session error  (Read 6073 times)


  • Jr. Member
  • **
  • Posts: 54
    • View Profile
Re: resetPassword() and expired session error
« Reply #15 on: March 08, 2014, 09:21:39 AM »

I'm not sure I follow your suggestion. Are you suggesting that you could create a delegate protocol for the FatFractal SDK? That's not a bad idea, but you'd somehow have to pass in the FatFractal call that just failed.

In other words, if we had a didReceiveAuthenticationFailure: delegate method, end-users like me could use that as a place to logout and log in again, but after re-authenticating, we still have to kick off the original request again. And there's no way to tell what the original FatFractal call was from within a common delegate method.

I suppose you could add a block parameter that contains the original FatFractal call for us to use. Something with a signature along the lines of:

Code: [Select]
- (void)didReceiveAuthenticationError:(NSError *)error fromFatFractal:(FatFractal *)fatFractal originalCall:(void (^)(void))blockContainingOriginalCall;
That would allow us to re-authenticate, then kick off the original call again...
Code: [Select]
- (void) didReceiveAuthenticationError:(NSError *)error fromFatFractal:(FatFractal *)fatFractal originalCall:(void (^)(void))blockContainingOriginalCall {

    [fatFractal logout];
    NSString *aUsername = ... // Get the user's username from wherever you stored it
    NSString *aPassword = ... // Get the user's password from wherever you stored it
    [fatFractal loginWithUserName:aUsername andPassword:aPassword onComplete:^(NSError *theErr, id theObj, NSHTTPURLResponse *theResponse) {
        if(theErr == nil) {

            // Successful login
        else {
            // Login failed
           // Do failure stuff here

That would be one heck of an odd ball delegate method (I'm not aware of any other iOS delegates methods that get passed a block.), but it might be useful. It would encapsulate a block of code that would otherwise show up in every FatFractal call, and it would hide the confusion that surrounds recursive blocks from the end user (which will probably help them write safer code).

Please let me know if I completely misinterpreted your comment.


  • Administrator
  • *****
  • Posts: 375
    • View Profile
Re: resetPassword() and expired session error
« Reply #16 on: March 08, 2014, 10:18:46 AM »
All I was thinking was that in order to save on boilerplate everywhere to cope with auth failure, it might be more useful to have a delegate to handle it. Wasn't thinking of going as far as retrying the original

Will think some more


Copyright © FatFractal customer forums