iOS SDK Version

FBSDKGraphErrorRecoveryProcessor

@interfaceFBSDKGraphErrorRecoveryProcessor:NSObject
Defines a type that can process Facebook NSErrors with best practices.
Facebook NSErrors can contain FBSDKErrorRecoveryAttempting instances to recover from errors, or localized messages to present to the user. This class will process the instances as follows:
  1. If the error is temporary as indicated by FBSDKGraphRequestErrorKey, assume the recovery succeeded and notify the delegate.
  2. If a FBSDKErrorRecoveryAttempting instance is available, display an alert (dispatched to main thread) with the recovery options and call the instance’s [ attemptRecoveryFromError:optionIndex:…].
  3. If a FBSDKErrorRecoveryAttempting is not available, check the userInfo for FBSDKLocalizedErrorDescriptionKey and present that in an alert (dispatched to main thread).
By default, FBSDKGraphRequests use this type to process errors and retry the request upon a successful recovery.
Note that Facebook recovery attempters can present UI or even cause app switches (such as to login). Any such work is dispatched to the main thread (therefore your request handlers may then run on the main thread).
Login recovery requires FBSDKLoginKit. Login will prompt the user for all permissions last granted. If any are declined on the new request, the recovery is not successful but the [FBSDKAccessToken currentAccessToken] might still have been updated. .
  • Gets the delegate. Note this is a strong reference, and is nil'ed out after recovery is complete.

    Declaration

    Objective-C
    @property(nonatomic,strong,readonly,nullable)id<FBSDKGraphErrorRecoveryProcessorDelegate>delegate;
  • Attempts to process the error, return YES if the error can be processed.

    Declaration

    Objective-C
    -(BOOL)processError:(nonnullNSError*)errorrequest:(nonnullFBSDKGraphRequest*)requestdelegate:(nullableid<FBSDKGraphErrorRecoveryProcessorDelegate>)delegate;

    Parameters

    error
    the error to process.
    request
    the related request that may be reissued.
    delegate
    the delegate that will be retained until recovery is complete.
  • The callback for FBSDKErrorRecoveryAttempting

    Declaration

    Objective-C
    -(void)didPresentErrorWithRecovery:(BOOL)didRecovercontextInfo:(nullablevoid*)contextInfo;

    Parameters

    didRecover
    if the recovery succeeded
    contextInfo
    unused