FBNativeDialogs
This class is no longer available in the most recent version of the SDK.
A more recent version of this class is available. Check out the latest version.

Provides methods to display native (i.e., non-Web-based) dialogs to the user. Currently the iOS 6 sharing dialog is supported.

Inherits from:NSObject
Declared in:FBNativeDialogs.h
Class Methods
canPresentFBShareDialogWithOpenGraphActionParams:

Determines whether a call to presentFBShareDialogWithOpenGraphActionParams:clientState:handler: will successfully present a dialog in the Facebook application. This is useful for applications that need to modify the available UI controls depending on whether the dialog is available on the current platform.

ParameterDescription
params

The parameters for the FB share dialog.

+ (BOOL) canPresentFBShareDialogWithOpenGraphActionParams:(FBOpenGraphActionShareDialogParams *)params;
Declared In: FBNativeDialogs.h
canPresentFBShareDialogWithParams:

Determines whether a call to presentFBShareDialogWithTarget: will successfully present a dialog in the Facebook application. This is useful for applications that need to modify the available UI controls depending on whether the dialog is available on the current platform.

ParameterDescription
params

The parameters for the FB share dialog.

+ (BOOL) canPresentFBShareDialogWithParams:(FBShareDialogParams *)params;
Declared In: FBNativeDialogs.h
canPresentRandomMultipleDialogWithNumber:

Determines whether the corresponding presentRandomNumberDialogWithAppName:clientState:handler: is supported by the installed version of the Facebook app for iOS.

+ (BOOL) canPresentRandomMultipleDialogWithNumber:(NSInteger)multiple;
Declared In: FBNativeDialogs.h
canPresentShareDialogWithSession:

Determines whether a call to presentShareDialogModallyFrom: will successfully present a dialog. This is useful for applications that need to modify the available UI controls depending on whether the dialog is available on the current platform and for the current user.

ParameterDescription
session

The to use to determine whether or not the user has been authenticated with iOS native authentication. If nil, then [FBSession activeSession] will be checked. See discussion above for the implications of nil or non-nil session.

+ (BOOL) canPresentShareDialogWithSession:(FBSession*)session;
Declared In: FBNativeDialogs.h
presentFBShareDialogWithLink:name:caption:description:picture:clientState:handler:

Presents a dialog in the Facebook application that allows the user to share the supplied link. No session is required, and the app does not need to be authorized to call this.

Note that this will perform an app switch to the Facebook app, and will cause the current app to be suspended. When the share is complete, the Facebook app will redirect to a url of the form "fb{APP_ID}://" that the application must handle. The app should then call [FBAppAction handleOpenURL:sourceApplication:fallbackHandler:] to trigger the appropriate handling. Note that FBAppAction will first try to call the completion handler associated with this method, but since during an app switch, the calling app may be suspended or killed, the app must also give a fallbackHandler to the handleOpenURL: method in FBAppAction.

ParameterDescription
link

The URL link to be attached to the post.

name

The name, or title associated with the link. May be nil.

caption

The caption to be used with the link. May be nil.

description

The description associated with the link. May be nil.

picture

The link to a thumbnail to associate with the link. May be nil.

clientState

An NSDictionary that's passed through when the completion handler is called. This is useful for the app to maintain state about the share request that was made so as to have appropriate action when the handler is called. May be nil.

handler

A completion handler that may be called when the status update is complete.

+ (FBAppAction *)
presentFBShareDialogWithLink: (NSURL *)link
name: (NSString *)name
caption: (NSString *)caption
description: (NSString *)description
picture: (NSURL *)picture
clientState: (NSDictionary *)clientState
handler: (FBAppActionCompletionHandler)handler;
Declared In: FBNativeDialogs.h
presentFBShareDialogWithOpenGraphAction:actionType:previewPropertyName:clientState:handler:

Presents a dialog in the Facebook application that allows the user to publish the supplied Open Graph action. No session is required, and the app does not need to be authorized to call this.

Note that this will perform an app switch to the Facebook app, and will cause the current app to be suspended. When the share is complete, the Facebook app will redirect to a url of the form "fb{APP_ID}://" that the application must handle. The app should then call [FBAppAction handleOpenURL:sourceApplication:fallbackHandler:] to trigger the appropriate handling. Note that FBAppAction will first try to call the completion handler associated with this method, but since during an app switch, the calling app may be suspended or killed, the app must also give a fallbackHandler to the handleOpenURL: method in FBAppAction.

ParameterDescription
action

The Open Graph action to be published. May not be nil.

actionType

The fully-specified Open Graph action type of the action (e.g., my_app_namespace:my_action).

previewPropertyName

The name of the property on the action that represents the primary Open Graph object associated with the action; this object will be displayed in the preview portion of the share dialog.

clientState

An NSDictionary that's passed through when the completion handler is called. This is useful for the app to maintain state about the share request that was made so as to have appropriate action when the handler is called. May be nil.

handler

A completion handler that may be called when the status update is complete.

+ (FBAppAction *)
presentFBShareDialogWithOpenGraphAction: (id<FBOpenGraphAction>)action
actionType: (NSString *)actionType
previewPropertyName: (NSString*)previewPropertyName
clientState: (NSDictionary *)clientState
handler: (FBAppActionCompletionHandler)handler;
Declared In: FBNativeDialogs.h
presentFBShareDialogWithOpenGraphActionParams:clientState:handler:

Presents a dialog in the Facebook application that allows the user to publish an Open Graph action. No session is required, and the app does not need to be authorized to call this.

Note that this will perform an app switch to the Facebook app, and will cause the current app to be suspended. When the share is complete, the Facebook app will redirect to a url of the form "fb{APP_ID}://" that the application must handle. The app should then call [FBAppAction handleOpenURL:sourceApplication:fallbackHandler:] to trigger the appropriate handling. Note that FBAppAction will first try to call the completion handler associated with this method, but since during an app switch, the calling app may be suspended or killed, the app must also give a fallbackHandler to the handleOpenURL: method in FBAppAction.

ParameterDescription
params

The parameters for the Open Graph action dialog.

clientState

An NSDictionary that's passed through when the completion handler is called. This is useful for the app to maintain state about the share request that was made so as to have appropriate action when the handler is called. May be nil.

handler

A completion handler that may be called when the status update is complete.

+ (FBAppAction *)
presentFBShareDialogWithOpenGraphActionParams: (FBOpenGraphActionShareDialogParams *)params
clientState: (NSDictionary *)clientState
handler: (FBAppActionCompletionHandler)handler;
Declared In: FBNativeDialogs.h
presentFBShareDialogWithParams:clientState:handler:

Presents a dialog in the Facebook application that allows the user to share a status update that may include text, images, or URLs. No session is required, and the app does not need to be authorized to call this.

Note that this will perform an app switch to the Facebook app, and will cause the current app to be suspended. When the share is complete, the Facebook app will redirect to a url of the form "fb{APP_ID}://" that the application must handle. The app should then call [FBAppAction handleOpenURL:sourceApplication:fallbackHandler:] to trigger the appropriate handling. Note that FBAppAction will first try to call the completion handler associated with this method, but since during an app switch, the calling app may be suspended or killed, the app must also give a fallbackHandler to the handleOpenURL: method in FBAppAction.

ParameterDescription
params

The parameters for the FB share dialog.

clientState

An NSDictionary that's passed through when the completion handler is called. This is useful for the app to maintain state about the share request that was made so as to have appropriate action when the handler is called. May be nil.

handler

A completion handler that may be called when the status update is complete.

+ (FBAppAction *)
presentFBShareDialogWithParams: (FBShareDialogParams *)params
clientState: (NSDictionary *)clientState
handler: (FBAppActionCompletionHandler)handler;
Declared In: FBNativeDialogs.h
presentRandomMultipleDialogWithNumber:clientState:handler:

Demonstrating the use of the Native Bridge. The other half of the work flow is triggered by calling the handleOpenUrl static method on FBAppAction.

+ (FBAppAction *)
presentRandomMultipleDialogWithNumber: (NSInteger)multiple
clientState: (NSDictionary *)clientState
handler: (FBAppActionCompletionHandler)handler;
Declared In: FBNativeDialogs.h
presentShareDialogModallyFrom:initialText:image:url:handler:

Presents a dialog that allows the user to share a status update that may include text, images, or URLs. This dialog is only available on iOS 6.0 and above. The current active session returned by [FBSession activeSession] will be used to determine whether the dialog will be displayed. If a session is active, it must be open and the login method used to authenticate the user must be native iOS 6.0 authentication. If no session active, then whether the call succeeds or not will depend on whether Facebook integration has been configured.

ParameterDescription
viewController

The view controller which will present the dialog.

initialText

The text which will initially be populated in the dialog. The user will have the opportunity to edit this text before posting it. May be nil.

image

A UIImage that will be attached to the status update. May be nil.

url

An NSURL that will be attached to the status update. May be nil.

handler

A handler that will be called when the dialog is dismissed, or if an error occurs. May be nil.

+ (BOOL)
presentShareDialogModallyFrom: (UIViewController*)viewController
initialText: (NSString*)initialText
image: (UIImage*)image
url: (NSURL*)url
handler: (FBShareDialogHandler)handler;
Declared In: FBNativeDialogs.h
presentShareDialogModallyFrom:initialText:images:urls:handler:

Presents a dialog that allows the user to share a status update that may include text, images, or URLs. This dialog is only available on iOS 6.0 and above. The current active session returned by [FBSession activeSession] will be used to determine whether the dialog will be displayed. If a session is active, it must be open and the login method used to authenticate the user must be native iOS 6.0 authentication. If no session active, then whether the call succeeds or not will depend on whether Facebook integration has been configured.

ParameterDescription
viewController

The view controller which will present the dialog.

initialText

The text which will initially be populated in the dialog. The user will have the opportunity to edit this text before posting it. May be nil.

images

An array of UIImages that will be attached to the status update. May be nil.

urls

An array of NSURLs that will be attached to the status update. May be nil.

handler

A handler that will be called when the dialog is dismissed, or if an error occurs. May be nil.

+ (BOOL)
presentShareDialogModallyFrom: (UIViewController*)viewController
initialText: (NSString*)initialText
images: (NSArray*)images
urls: (NSArray*)urls
handler: (FBShareDialogHandler)handler;
Declared In: FBNativeDialogs.h
presentShareDialogModallyFrom:session:initialText:images:urls:handler:

Presents a dialog that allows the user to share a status update that may include text, images, or URLs. This dialog is only available on iOS 6.0 and above. An FBSession may be specified, or nil may be passed to indicate that the current active session should be used. If a session is specified (whether explicitly or by virtue of being the active session), it must be open and the login method used to authenticate the user must be native iOS 6.0 authentication. If no session is specified (and there is no active session), then whether the call succeeds or not will depend on whether Facebook integration has been configured.

ParameterDescription
viewController

The view controller which will present the dialog.

session

The to use to determine whether or not the user has been authenticated with iOS native authentication. If nil, then [FBSession activeSession] will be checked. See discussion above for the implications of nil or non-nil session.

initialText

The text which will initially be populated in the dialog. The user will have the opportunity to edit this text before posting it. May be nil.

images

An array of UIImages that will be attached to the status update. May be nil.

urls

An array of NSURLs that will be attached to the status update. May be nil.

handler

A handler that will be called when the dialog is dismissed, or if an error occurs. May be nil.

+ (BOOL)
presentShareDialogModallyFrom: (UIViewController*)viewController
session: (FBSession*)session
initialText: (NSString*)initialText
images: (NSArray*)images
urls: (NSArray*)urls
handler: (FBShareDialogHandler)handler;
Declared In: FBNativeDialogs.h
Typedefs
FBNativeDialogResult

Passed to a handler to indicate the result of a dialog being displayed to the user.

typedef enum {
FBNativeDialogResultSucceeded,
FBNativeDialogResultCancelled,
FBNativeDialogResultError
} FBNativeDialogResult;
Discussion:

Enum

Declared In: FBNativeDialogs.h
FBShareDialogHandler

Defines a handler that will be called in response to the native share dialog being displayed.

typedef void (^FBShareDialogHandler)(
FBNativeDialogResult result,
NSError *error);
Declared In: FBNativeDialogs.h