This commit is contained in:
giuseppenuc committed 2016-12-20 16:02:27 +01:00
1 parent 1bf4b9ef1d
commit 4e66c377fd
664 files changed
+14818 -10172

No files matched your search

@@ -18,84 +18,79 @@
#import <Foundation/Foundation.h>
#import "FBSDKAppGroupContent.h"
#import <FBSDKShareKit/FBSDKAppGroupContent.h>
@protocol FBSDKAppGroupAddDialogDelegate;
/*!
@abstract A dialog for creating app groups.
/**
- Warning:App and game groups are being deprecated. See https://developers.facebook.com/docs/games/services/game-groups for more information.
*/
__attribute__ ((deprecated))
@interface FBSDKAppGroupAddDialog : NSObject
/*!
@abstract Convenience method to build up an app group dialog with content and a delegate.
@param content The content for the app group.
@param delegate The receiver's delegate.
/**
- Warning:App and game groups are being deprecated. See https://developers.facebook.com/docs/games/services/game-groups for more information.
*/
+ (instancetype)showWithContent:(FBSDKAppGroupContent *)content
delegate:(id<FBSDKAppGroupAddDialogDelegate>)delegate;
delegate:(id<FBSDKAppGroupAddDialogDelegate>)delegate __attribute__ ((deprecated));
/*!
@abstract The receiver's delegate or nil if it doesn't have a delegate.
*/
@property (nonatomic, weak) id<FBSDKAppGroupAddDialogDelegate> delegate;
/**
/*!
@abstract The content for app group.
- Warning:App and game groups are being deprecated. See https://developers.facebook.com/docs/games/services/game-groups for more information.
*/
@property (nonatomic, copy) FBSDKAppGroupContent *content;
@property (nonatomic, weak) id<FBSDKAppGroupAddDialogDelegate> delegate __attribute__ ((deprecated));
/*!
@abstract A Boolean value that indicates whether the receiver can initiate an app group dialog.
@discussion May return NO if the appropriate Facebook app is not installed and is required or an access token is
required but not available. This method does not validate the content on the receiver, so this can be checked before
building up the content.
@see validateWithError:
@result YES if the receiver can share, otherwise NO.
*/
- (BOOL)canShow;
/**
/*!
@abstract Begins the app group dialog from the receiver.
@result YES if the receiver was able to show the dialog, otherwise NO.
- Warning:App and game groups are being deprecated. See https://developers.facebook.com/docs/games/services/game-groups for more information.
*/
- (BOOL)show;
@property (nonatomic, copy) FBSDKAppGroupContent *content __attribute__ ((deprecated));
/*!
@abstract Validates the content on the receiver.
@param errorRef If an error occurs, upon return contains an NSError object that describes the problem.
@return YES if the content is valid, otherwise NO.
/**
- Warning:App and game groups are being deprecated. See https://developers.facebook.com/docs/games/services/game-groups for more information.
*/
- (BOOL)validateWithError:(NSError *__autoreleasing *)errorRef;
- (BOOL)canShow __attribute__ ((deprecated));
/**
- Warning:App and game groups are being deprecated. See https://developers.facebook.com/docs/games/services/game-groups for more information.
*/
- (BOOL)show __attribute__ ((deprecated));
/**
- Warning:App and game groups are being deprecated. See https://developers.facebook.com/docs/games/services/game-groups for more information.
*/
- (BOOL)validateWithError:(NSError *__autoreleasing *)errorRef __attribute__ ((deprecated));
@end
/*!
@abstract A delegate for FBSDKAppGroupAddDialog.
@discussion The delegate is notified with the results of the app group request as long as the application has
permissions to receive the information. For example, if the person is not signed into the containing app, the shower
may not be able to distinguish between completion of an app group request and cancellation.
/**
- Warning:App and game groups are being deprecated. See https://developers.facebook.com/docs/games/services/game-groups for more information.
*/
__attribute__ ((deprecated))
@protocol FBSDKAppGroupAddDialogDelegate <NSObject>
/*!
@abstract Sent to the delegate when the app group request completes without error.
@param appGroupAddDialog The FBSDKAppGroupAddDialog that completed.
@param results The results from the dialog. This may be nil or empty.
*/
- (void)appGroupAddDialog:(FBSDKAppGroupAddDialog *)appGroupAddDialog didCompleteWithResults:(NSDictionary *)results;
/**
/*!
@abstract Sent to the delegate when the app group request encounters an error.
@param appGroupAddDialog The FBSDKAppGroupAddDialog that completed.
@param error The error.
- Warning:App and game groups are being deprecated. See https://developers.facebook.com/docs/games/services/game-groups for more information.
*/
- (void)appGroupAddDialog:(FBSDKAppGroupAddDialog *)appGroupAddDialog didFailWithError:(NSError *)error;
- (void)appGroupAddDialog:(FBSDKAppGroupAddDialog *)appGroupAddDialog didCompleteWithResults:(NSDictionary *)results __attribute__ ((deprecated));
/*!
@abstract Sent to the delegate when the app group dialog is cancelled.
@param appGroupAddDialog The FBSDKAppGroupAddDialog that completed.
/**
- Warning:App and game groups are being deprecated. See https://developers.facebook.com/docs/games/services/game-groups for more information.
*/
- (void)appGroupAddDialogDidCancel:(FBSDKAppGroupAddDialog *)appGroupAddDialog;
- (void)appGroupAddDialog:(FBSDKAppGroupAddDialog *)appGroupAddDialog didFailWithError:(NSError *)error __attribute__ ((deprecated));
/**
- Warning:App and game groups are being deprecated. See https://developers.facebook.com/docs/games/services/game-groups for more information.
*/
- (void)appGroupAddDialogDidCancel:(FBSDKAppGroupAddDialog *)appGroupAddDialog __attribute__ ((deprecated));
@end
@@ -21,47 +21,47 @@
#import <FBSDKCoreKit/FBSDKCopying.h>
#import <FBSDKCoreKit/FBSDKMacros.h>
/*!
@typedef NS_ENUM(NSUInteger, FBSDKAppGroupPrivacy)
@abstract Specifies the privacy of a group.
/**
NS_ENUM(NSUInteger, FBSDKAppGroupPrivacy)
Specifies the privacy of a group.
*/
typedef NS_ENUM(NSUInteger, FBSDKAppGroupPrivacy)
{
/*! Anyone can see the group, who's in it and what members post. */
/** Anyone can see the group, who's in it and what members post. */
FBSDKAppGroupPrivacyOpen = 0,
/*! Anyone can see the group and who's in it, but only members can see posts. */
/** Anyone can see the group and who's in it, but only members can see posts. */
FBSDKAppGroupPrivacyClosed,
};
/*!
@abstract Converts an FBSDKAppGroupPrivacy to an NSString.
/**
Converts an FBSDKAppGroupPrivacy to an NSString.
*/
FBSDK_EXTERN NSString *NSStringFromFBSDKAppGroupPrivacy(FBSDKAppGroupPrivacy privacy);
/*!
@abstract A model for creating an app group.
/**
A model for creating an app group.
*/
@interface FBSDKAppGroupContent : NSObject <FBSDKCopying, NSSecureCoding>
/*!
@abstract The description of the group.
/**
The description of the group.
*/
@property (nonatomic, copy) NSString *groupDescription;
/*!
@abstract The name of the group.
/**
The name of the group.
*/
@property (nonatomic, copy) NSString *name;
/*!
@abstract The privacy for the group.
/**
The privacy for the group.
*/
@property (nonatomic, assign) FBSDKAppGroupPrivacy privacy;
/*!
@abstract Compares the receiver to another app group content.
@param content The other content
@return YES if the receiver's values are equal to the other content's values; otherwise NO
/**
Compares the receiver to another app group content.
- Parameter content: The other content
- Returns: YES if the receiver's values are equal to the other content's values; otherwise NO
*/
- (BOOL)isEqualToAppGroupContent:(FBSDKAppGroupContent *)content;
@@ -20,80 +20,73 @@
@protocol FBSDKAppGroupJoinDialogDelegate;
/*!
@abstract A dialog for joining app groups.
/**
- Warning:App and game groups are being deprecated. See https://developers.facebook.com/docs/games/services/game-groups for more information.
*/
__attribute__ ((deprecated))
@interface FBSDKAppGroupJoinDialog : NSObject
/*!
@abstract Convenience method to build up an app group dialog with content and a delegate.
@param groupID The ID for the group.
@param delegate The receiver's delegate.
/**
- Warning:App and game groups are being deprecated. See https://developers.facebook.com/docs/games/services/game-groups for more information.
*/
+ (instancetype)showWithGroupID:(NSString *)groupID
delegate:(id<FBSDKAppGroupJoinDialogDelegate>)delegate;
delegate:(id<FBSDKAppGroupJoinDialogDelegate>)delegate __attribute__ ((deprecated));
/*!
@abstract The receiver's delegate or nil if it doesn't have a delegate.
*/
@property (nonatomic, weak) id<FBSDKAppGroupJoinDialogDelegate> delegate;
/**
/*!
@abstract The ID for group.
*/
@property (nonatomic, copy) NSString *groupID;
- Warning:App and game groups are being deprecated. See https://developers.facebook.com/docs/games/services/game-groups for more information. */
@property (nonatomic, weak) id<FBSDKAppGroupJoinDialogDelegate> delegate __attribute__ ((deprecated));
/*!
@abstract A Boolean value that indicates whether the receiver can initiate an app group dialog.
@discussion May return NO if the appropriate Facebook app is not installed and is required or an access token is
required but not available. This method does not validate the content on the receiver, so this can be checked before
building up the content.
@see validateWithError:
@result YES if the receiver can share, otherwise NO.
*/
- (BOOL)canShow;
/**
/*!
@abstract Begins the app group dialog from the receiver.
@result YES if the receiver was able to show the dialog, otherwise NO.
*/
- (BOOL)show;
- Warning:App and game groups are being deprecated. See https://developers.facebook.com/docs/games/services/game-groups for more information. */
@property (nonatomic, copy) NSString *groupID __attribute__ ((deprecated));
/*!
@abstract Validates the content on the receiver.
@param errorRef If an error occurs, upon return contains an NSError object that describes the problem.
@return YES if the content is valid, otherwise NO.
/**
- Warning:App and game groups are being deprecated. See https://developers.facebook.com/docs/games/services/game-groups for more information.
*/
- (BOOL)validateWithError:(NSError *__autoreleasing *)errorRef;
- (BOOL)canShow __attribute__ ((deprecated));
/**
- Warning:App and game groups are being deprecated. See https://developers.facebook.com/docs/games/services/game-groups for more information.
*/
- (BOOL)show __attribute__ ((deprecated));
/**
- Warning:App and game groups are being deprecated. See https://developers.facebook.com/docs/games/services/game-groups for more information.
*/
- (BOOL)validateWithError:(NSError *__autoreleasing *)errorRef __attribute__ ((deprecated));
@end
/*!
@abstract A delegate for FBSDKAppGroupJoinDialog.
@discussion The delegate is notified with the results of the app group request as long as the application has
permissions to receive the information. For example, if the person is not signed into the containing app, the shower
may not be able to distinguish between completion of an app group request and cancellation.
/**
- Warning:App and game groups are being deprecated. See https://developers.facebook.com/docs/games/services/game-groups for more information.
*/
__attribute__ ((deprecated))
@protocol FBSDKAppGroupJoinDialogDelegate <NSObject>
/*!
@abstract Sent to the delegate when the app group request completes without error.
@param appGroupJoinDialog The FBSDKAppGroupJoinDialog that completed.
@param results The results from the dialog. This may be nil or empty.
*/
- (void)appGroupJoinDialog:(FBSDKAppGroupJoinDialog *)appGroupJoinDialog didCompleteWithResults:(NSDictionary *)results;
/**
/*!
@abstract Sent to the delegate when the app group request encounters an error.
@param appGroupJoinDialog The FBSDKAppGroupJoinDialog that completed.
@param error The error.
- Warning:App and game groups are being deprecated. See https://developers.facebook.com/docs/games/services/game-groups for more information.
*/
- (void)appGroupJoinDialog:(FBSDKAppGroupJoinDialog *)appGroupJoinDialog didFailWithError:(NSError *)error;
- (void)appGroupJoinDialog:(FBSDKAppGroupJoinDialog *)appGroupJoinDialog didCompleteWithResults:(NSDictionary *)results __attribute__ ((deprecated));
/*!
@abstract Sent to the delegate when the app group dialog is cancelled.
@param appGroupJoinDialog The FBSDKAppGroupJoinDialog that completed.
/**
- Warning:App and game groups are being deprecated. See https://developers.facebook.com/docs/games/services/game-groups for more information.
*/
- (void)appGroupJoinDialogDidCancel:(FBSDKAppGroupJoinDialog *)appGroupJoinDialog;
- (void)appGroupJoinDialog:(FBSDKAppGroupJoinDialog *)appGroupJoinDialog didFailWithError:(NSError *)error __attribute__ ((deprecated));
/**
- Warning:App and game groups are being deprecated. See https://developers.facebook.com/docs/games/services/game-groups for more information.
*/
- (void)appGroupJoinDialogDidCancel:(FBSDKAppGroupJoinDialog *)appGroupJoinDialog __attribute__ ((deprecated));
@end
@@ -20,50 +20,75 @@
#import <FBSDKCoreKit/FBSDKCopying.h>
/*!
@abstract A model for app invite.
/**
NS_ENUM(NSUInteger, FBSDKAppInviteDestination)
Specifies the privacy of a group.
*/
typedef NS_ENUM(NSUInteger, FBSDKAppInviteDestination)
{
/** Deliver to Facebook. */
FBSDKAppInviteDestinationFacebook = 0,
/** Deliver to Messenger. */
FBSDKAppInviteDestinationMessenger,
};
/**
A model for app invite.
*/
@interface FBSDKAppInviteContent : NSObject <FBSDKCopying, NSSecureCoding>
/*!
@abstract A URL to a preview image that will be displayed with the app invite
/**
A URL to a preview image that will be displayed with the app invite
@discussion This is optional. If you don't include it a fallback image will be used.
This is optional. If you don't include it a fallback image will be used.
*/
@property (nonatomic, copy) NSURL *appInvitePreviewImageURL;
/*!
@abstract An app link target that will be used as a target when the user accept the invite.
/**
An app link target that will be used as a target when the user accept the invite.
@discussion This is a requirement.
This is a requirement.
*/
@property (nonatomic, copy) NSURL *appLinkURL;
/*!
@deprecated Use `appInvitePreviewImageURL` instead.
/**
- Warning:Use `appInvitePreviewImageURL` instead.
*/
@property (nonatomic, copy) NSURL *previewImageURL __attribute__ ((deprecated("use appInvitePreviewImageURL instead")));
/*!
@abstract Promotional code to be displayed while sending and receiving the invite.
/**
Promotional code to be displayed while sending and receiving the invite.
@discussion This is optional. This can be between 0 and 10 characters long and can contain
This is optional. This can be between 0 and 10 characters long and can contain
alphanumeric characters only. To set a promo code, you need to set promo text.
*/
@property (nonatomic, copy) NSString *promotionCode;
/*!
@abstract Promotional text to be displayed while sending and receiving the invite.
/**
Promotional text to be displayed while sending and receiving the invite.
@discussion This is optional. This can be between 0 and 80 characters long and can contain
This is optional. This can be between 0 and 80 characters long and can contain
alphanumeric and spaces only.
*/
@property (nonatomic, copy) NSString *promotionText;
/*!
@abstract Compares the receiver to another app invite content.
@param content The other content
@return YES if the receiver's values are equal to the other content's values; otherwise NO
/**
Destination for the app invite.
This is optional and for declaring destination of the invite.
*/
@property FBSDKAppInviteDestination destination;
/**
Compares the receiver to another app invite content.
- Parameter content: The other content
- Returns: YES if the receiver's values are equal to the other content's values; otherwise NO
*/
- (BOOL)isEqualToAppInviteContent:(FBSDKAppInviteContent *)content;
@@ -24,6 +24,7 @@
#define FBSDK_APP_INVITE_CONTENT_PREVIEW_IMAGE_KEY @"previewImage"
#define FBSDK_APP_INVITE_CONTENT_PROMO_CODE_KEY @"promoCode"
#define FBSDK_APP_INVITE_CONTENT_PROMO_TEXT_KEY @"promoText"
#define FBSDK_APP_INVITE_CONTENT_DESTINATION_KEY @"destination"
@implementation FBSDKAppInviteContent
@@ -68,7 +69,8 @@
[FBSDKInternalUtility object:_appLinkURL isEqualToObject:content.appLinkURL] &&
[FBSDKInternalUtility object:_appInvitePreviewImageURL isEqualToObject:content.appInvitePreviewImageURL] &&
[FBSDKInternalUtility object:_promotionText isEqualToObject:content.promotionText] &&
[FBSDKInternalUtility object:_promotionCode isEqualToObject:content.promotionText]
[FBSDKInternalUtility object:_promotionCode isEqualToObject:content.promotionText] &&
_destination == content.destination
);
}
@@ -88,6 +90,8 @@
FBSDK_APP_INVITE_CONTENT_PROMO_CODE_KEY];
_promotionText = [decoder decodeObjectOfClass:[NSString class] forKey:
FBSDK_APP_INVITE_CONTENT_PROMO_TEXT_KEY];
_destination = [decoder decodeIntegerForKey:
FBSDK_APP_INVITE_CONTENT_DESTINATION_KEY];
}
return self;
@@ -99,7 +103,7 @@
[encoder encodeObject:_appInvitePreviewImageURL forKey:FBSDK_APP_INVITE_CONTENT_PREVIEW_IMAGE_KEY];
[encoder encodeObject:_promotionCode forKey:FBSDK_APP_INVITE_CONTENT_PROMO_CODE_KEY];
[encoder encodeObject:_promotionText forKey:FBSDK_APP_INVITE_CONTENT_PROMO_TEXT_KEY];
[encoder encodeInt:_destination forKey:FBSDK_APP_INVITE_CONTENT_DESTINATION_KEY];
}
#pragma mark - NSCopying
@@ -111,6 +115,7 @@
copy->_appInvitePreviewImageURL = [_appInvitePreviewImageURL copy];
copy->_promotionText = [_promotionText copy];
copy->_promotionCode = [_promotionCode copy];
copy->_destination = _destination;
return copy;
}
@@ -19,92 +19,97 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "FBSDKAppInviteContent.h"
#import <FBSDKShareKit/FBSDKAppInviteContent.h>
@protocol FBSDKAppInviteDialogDelegate;
/*!
@abstract A dialog for sending App Invites.
/**
A dialog for sending App Invites.
*/
@interface FBSDKAppInviteDialog : NSObject
/*!
@abstract Convenience method to show a FBSDKAppInviteDialog
@param viewController A UIViewController to present the dialog from.
@param content The content for the app invite.
@param delegate The receiver's delegate.
/**
Convenience method to show a FBSDKAppInviteDialog
- Parameter viewController: A UIViewController to present the dialog from.
- Parameter content: The content for the app invite.
- Parameter delegate: The receiver's delegate.
*/
+ (instancetype)showFromViewController:(UIViewController *)viewController
withContent:(FBSDKAppInviteContent *)content
delegate:(id<FBSDKAppInviteDialogDelegate>)delegate;
/*!
@deprecated use showFromViewController:withContent:delegate: instead
/**
- Warning:use showFromViewController:withContent:delegate: instead
*/
+ (instancetype)showWithContent:(FBSDKAppInviteContent *)content delegate:(id<FBSDKAppInviteDialogDelegate>)delegate
__attribute__ ((deprecated("use showFromViewController:withContent:delegate: instead")));
/*!
@abstract A UIViewController to present the dialog from.
@discussion If not specified, the top most view controller will be automatically determined as best as possible.
/**
A UIViewController to present the dialog from.
If not specified, the top most view controller will be automatically determined as best as possible.
*/
@property (nonatomic, weak) UIViewController *fromViewController;
/*!
@abstract The receiver's delegate or nil if it doesn't have a delegate.
/**
The receiver's delegate or nil if it doesn't have a delegate.
*/
@property (nonatomic, weak) id<FBSDKAppInviteDialogDelegate> delegate;
/*!
@abstract The content for app invite.
/**
The content for app invite.
*/
@property (nonatomic, copy) FBSDKAppInviteContent *content;
/*!
@abstract A Boolean value that indicates whether the receiver can initiate an app invite.
@discussion May return NO if the appropriate Facebook app is not installed and is required or an access token is
/**
A Boolean value that indicates whether the receiver can initiate an app invite.
May return NO if the appropriate Facebook app is not installed and is required or an access token is
required but not available. This method does not validate the content on the receiver, so this can be checked before
building up the content.
@see validateWithError:
@result YES if the receiver can show the dialog, otherwise NO.
- See:validateWithError:
- Returns: YES if the receiver can show the dialog, otherwise NO.
*/
- (BOOL)canShow;
/*!
@abstract Begins the app invite from the receiver.
@result YES if the receiver was able to show the dialog, otherwise NO.
/**
Begins the app invite from the receiver.
- Returns: YES if the receiver was able to show the dialog, otherwise NO.
*/
- (BOOL)show;
/*!
@abstract Validates the content on the receiver.
@param errorRef If an error occurs, upon return contains an NSError object that describes the problem.
@return YES if the content is valid, otherwise NO.
/**
Validates the content on the receiver.
- Parameter errorRef: If an error occurs, upon return contains an NSError object that describes the problem.
- Returns: YES if the content is valid, otherwise NO.
*/
- (BOOL)validateWithError:(NSError *__autoreleasing *)errorRef;
@end
/*!
@abstract A delegate for FBSDKAppInviteDialog.
@discussion The delegate is notified with the results of the app invite as long as the application has permissions to
/**
A delegate for FBSDKAppInviteDialog.
The delegate is notified with the results of the app invite as long as the application has permissions to
receive the information. For example, if the person is not signed into the containing app, the shower may not be able
to distinguish between completion of an app invite and cancellation.
*/
@protocol FBSDKAppInviteDialogDelegate <NSObject>
/*!
@abstract Sent to the delegate when the app invite completes without error.
@param appInviteDialog The FBSDKAppInviteDialog that completed.
@param results The results from the dialog. This may be nil or empty.
/**
Sent to the delegate when the app invite completes without error.
- Parameter appInviteDialog: The FBSDKAppInviteDialog that completed.
- Parameter results: The results from the dialog. This may be nil or empty.
*/
- (void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didCompleteWithResults:(NSDictionary *)results;
/*!
@abstract Sent to the delegate when the app invite encounters an error.
@param appInviteDialog The FBSDKAppInviteDialog that completed.
@param error The error.
/**
Sent to the delegate when the app invite encounters an error.
- Parameter appInviteDialog: The FBSDKAppInviteDialog that completed.
- Parameter error: The error.
*/
- (void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didFailWithError:(NSError *)error;
@@ -83,6 +83,23 @@
[FBSDKInternalUtility dictionary:parameters setObject:self.content.appLinkURL forKey:@"app_link_url"];
[FBSDKInternalUtility dictionary:parameters setObject:self.content.appInvitePreviewImageURL forKey:@"preview_image_url"];
NSString *destination;
switch (self.content.destination) {
case FBSDKAppInviteDestinationMessenger:
destination = @"messenger";
break;
case FBSDKAppInviteDestinationFacebook:
destination = @"facebook";
break;
default:
destination = @"facebook";
break;
}
[FBSDKInternalUtility dictionary:parameters setObject:destination forKey:@"destination"];
if (self.content.promotionText) {
NSString *promotionCode = self.content.promotionCode ?: @"";
NSDictionary *deeplinkContext = @{@"promo_code" : promotionCode, @"promo_text" : self.content.promotionText};
@@ -20,111 +20,119 @@
#import <FBSDKCoreKit/FBSDKCopying.h>
/*!
@typedef NS_ENUM(NSUInteger, FBSDKGameRequestActionType)
@abstract Additional context about the nature of the request.
/**
NS_ENUM(NSUInteger, FBSDKGameRequestActionType)
Additional context about the nature of the request.
*/
typedef NS_ENUM(NSUInteger, FBSDKGameRequestActionType)
{
/*! No action type */
/** No action type */
FBSDKGameRequestActionTypeNone = 0,
/*! Send action type: The user is sending an object to the friends. */
/** Send action type: The user is sending an object to the friends. */
FBSDKGameRequestActionTypeSend,
/*! Ask For action type: The user is asking for an object from friends. */
/** Ask For action type: The user is asking for an object from friends. */
FBSDKGameRequestActionTypeAskFor,
/*! Turn action type: It is the turn of the friends to play against the user in a match. (no object) */
/** Turn action type: It is the turn of the friends to play against the user in a match. (no object) */
FBSDKGameRequestActionTypeTurn,
};
/*!
@typedef NS_ENUM(NSUInteger, FBSDKGameRequestFilters)
@abstract Filter for who can be displayed in the multi-friend selector.
/**
NS_ENUM(NSUInteger, FBSDKGameRequestFilters)
Filter for who can be displayed in the multi-friend selector.
*/
typedef NS_ENUM(NSUInteger, FBSDKGameRequestFilter)
{
/*! No filter, all friends can be displayed. */
/** No filter, all friends can be displayed. */
FBSDKGameRequestFilterNone = 0,
/*! Friends using the app can be displayed. */
/** Friends using the app can be displayed. */
FBSDKGameRequestFilterAppUsers,
/*! Friends not using the app can be displayed. */
/** Friends not using the app can be displayed. */
FBSDKGameRequestFilterAppNonUsers,
};
/*!
@abstract A model for a game request.
/**
A model for a game request.
*/
@interface FBSDKGameRequestContent : NSObject <FBSDKCopying, NSSecureCoding>
/*!
@abstract Used when defining additional context about the nature of the request.
@discussion The parameter 'objectID' is required if the action type is either
/**
Used when defining additional context about the nature of the request.
The parameter 'objectID' is required if the action type is either
'FBSDKGameRequestSendActionType' or 'FBSDKGameRequestAskForActionType'.
@seealso objectID
- SeeAlso:objectID
*/
@property (nonatomic, assign) FBSDKGameRequestActionType actionType;
/*!
@abstract Compares the receiver to another game request content.
@param content The other content
@return YES if the receiver's values are equal to the other content's values; otherwise NO
/**
Compares the receiver to another game request content.
- Parameter content: The other content
- Returns: YES if the receiver's values are equal to the other content's values; otherwise NO
*/
- (BOOL)isEqualToGameRequestContent:(FBSDKGameRequestContent *)content;
/*!
@abstract Additional freeform data you may pass for tracking. This will be stored as part of
/**
Additional freeform data you may pass for tracking. This will be stored as part of
the request objects created. The maximum length is 255 characters.
*/
@property (nonatomic, copy) NSString *data;
/*!
@abstract This controls the set of friends someone sees if a multi-friend selector is shown.
/**
This controls the set of friends someone sees if a multi-friend selector is shown.
It is FBSDKGameRequestNoFilter by default, meaning that all friends can be shown.
If specify as FBSDKGameRequestAppUsersFilter, only friends who use the app will be shown.
On the other hands, use FBSDKGameRequestAppNonUsersFilter to filter only friends who do not use the app.
@discussion The parameter name is preserved to be consistent with the counter part on desktop.
The parameter name is preserved to be consistent with the counter part on desktop.
*/
@property (nonatomic, assign) FBSDKGameRequestFilter filters;
/*!
@abstract A plain-text message to be sent as part of the request. This text will surface in the App Center view
/**
A plain-text message to be sent as part of the request. This text will surface in the App Center view
of the request, but not on the notification jewel. Required parameter.
*/
@property (nonatomic, copy) NSString *message;
/*!
@abstract The Open Graph object ID of the object being sent.
@seealso actionType
/**
The Open Graph object ID of the object being sent.
- SeeAlso:actionType
*/
@property (nonatomic, copy) NSString *objectID;
/*!
@abstract An array of user IDs, usernames or invite tokens (NSString) of people to send request.
@discussion These may or may not be a friend of the sender. If this is specified by the app,
/**
An array of user IDs, usernames or invite tokens (NSString) of people to send request.
These may or may not be a friend of the sender. If this is specified by the app,
the sender will not have a choice of recipients. If not, the sender will see a multi-friend selector
This is equivalent to the "to" parameter when using the web game request dialog.
*/
@property (nonatomic, copy) NSArray *recipients;
/*!
@abstract An array of user IDs that will be included in the dialog as the first suggested friends.
/**
An array of user IDs that will be included in the dialog as the first suggested friends.
Cannot be used together with filters.
@discussion This is equivalent to the "suggestions" parameter when using the web game request dialog.
This is equivalent to the "suggestions" parameter when using the web game request dialog.
*/
@property (nonatomic, copy) NSArray *recipientSuggestions;
/*!
@deprecated Use `recipientSuggestions` instead.
/**
- Warning:Use `recipientSuggestions` instead.
*/
@property (nonatomic, copy) NSArray *suggestions __attribute__ ((deprecated("use recipientSuggestions instead")));
/*!
@abstract The title for the dialog.
/**
The title for the dialog.
*/
@property (nonatomic, copy) NSString *title;
/*!
@deprecated Use `recipients` instead.
/**
- Warning:Use `recipients` instead.
*/
@property (nonatomic, copy) NSArray *to __attribute__ ((deprecated("use recipients instead")));
@@ -18,87 +18,90 @@
#import <Foundation/Foundation.h>
#import "FBSDKGameRequestContent.h"
#import <FBSDKShareKit/FBSDKGameRequestContent.h>
@protocol FBSDKGameRequestDialogDelegate;
/*!
@abstract A dialog for sending game requests.
/**
A dialog for sending game requests.
*/
@interface FBSDKGameRequestDialog : NSObject
/*!
@abstract Convenience method to build up a game request with content and a delegate.
@param content The content for the game request.
@param delegate The receiver's delegate.
/**
Convenience method to build up a game request with content and a delegate.
- Parameter content: The content for the game request.
- Parameter delegate: The receiver's delegate.
*/
+ (instancetype)showWithContent:(FBSDKGameRequestContent *)content delegate:(id<FBSDKGameRequestDialogDelegate>)delegate;
/*!
@abstract The receiver's delegate or nil if it doesn't have a delegate.
/**
The receiver's delegate or nil if it doesn't have a delegate.
*/
@property (nonatomic, weak) id<FBSDKGameRequestDialogDelegate> delegate;
/*!
@abstract The content for game request.
/**
The content for game request.
*/
@property (nonatomic, copy) FBSDKGameRequestContent *content;
/*!
@abstract Specifies whether frictionless requests are enabled.
/**
Specifies whether frictionless requests are enabled.
*/
@property (nonatomic, assign) BOOL frictionlessRequestsEnabled;
/*!
@abstract A Boolean value that indicates whether the receiver can initiate a game request.
@discussion May return NO if the appropriate Facebook app is not installed and is required or an access token is
/**
A Boolean value that indicates whether the receiver can initiate a game request.
May return NO if the appropriate Facebook app is not installed and is required or an access token is
required but not available. This method does not validate the content on the receiver, so this can be checked before
building up the content.
@see validateWithError:
@result YES if the receiver can share, otherwise NO.
- See:validateWithError:
- Returns: YES if the receiver can share, otherwise NO.
*/
- (BOOL)canShow;
/*!
@abstract Begins the game request from the receiver.
@result YES if the receiver was able to show the dialog, otherwise NO.
/**
Begins the game request from the receiver.
- Returns: YES if the receiver was able to show the dialog, otherwise NO.
*/
- (BOOL)show;
/*!
@abstract Validates the content on the receiver.
@param errorRef If an error occurs, upon return contains an NSError object that describes the problem.
@return YES if the content is valid, otherwise NO.
/**
Validates the content on the receiver.
- Parameter errorRef: If an error occurs, upon return contains an NSError object that describes the problem.
- Returns: YES if the content is valid, otherwise NO.
*/
- (BOOL)validateWithError:(NSError *__autoreleasing *)errorRef;
@end
/*!
@abstract A delegate for FBSDKGameRequestDialog.
@discussion The delegate is notified with the results of the game request as long as the application has permissions to
/**
A delegate for FBSDKGameRequestDialog.
The delegate is notified with the results of the game request as long as the application has permissions to
receive the information. For example, if the person is not signed into the containing app, the shower may not be able
to distinguish between completion of a game request and cancellation.
*/
@protocol FBSDKGameRequestDialogDelegate <NSObject>
/*!
@abstract Sent to the delegate when the game request completes without error.
@param gameRequestDialog The FBSDKGameRequestDialog that completed.
@param results The results from the dialog. This may be nil or empty.
/**
Sent to the delegate when the game request completes without error.
- Parameter gameRequestDialog: The FBSDKGameRequestDialog that completed.
- Parameter results: The results from the dialog. This may be nil or empty.
*/
- (void)gameRequestDialog:(FBSDKGameRequestDialog *)gameRequestDialog didCompleteWithResults:(NSDictionary *)results;
/*!
@abstract Sent to the delegate when the game request encounters an error.
@param gameRequestDialog The FBSDKGameRequestDialog that completed.
@param error The error.
/**
Sent to the delegate when the game request encounters an error.
- Parameter gameRequestDialog: The FBSDKGameRequestDialog that completed.
- Parameter error: The error.
*/
- (void)gameRequestDialog:(FBSDKGameRequestDialog *)gameRequestDialog didFailWithError:(NSError *)error;
/*!
@abstract Sent to the delegate when the game request dialog is cancelled.
@param gameRequestDialog The FBSDKGameRequestDialog that completed.
/**
Sent to the delegate when the game request dialog is cancelled.
- Parameter gameRequestDialog: The FBSDKGameRequestDialog that completed.
*/
- (void)gameRequestDialogDidCancel:(FBSDKGameRequestDialog *)gameRequestDialog;
@@ -20,39 +20,41 @@
#import <FBSDKCoreKit/FBSDKCopying.h>
/*!
@abstract Represents a single hashtag that can be used with the share dialog.
/**
Represents a single hashtag that can be used with the share dialog.
*/
@interface FBSDKHashtag : NSObject <FBSDKCopying, NSSecureCoding>
/*!
@abstract Convenience method to build a new hashtag with a string identifier. Equivalent to setting the
/**
Convenience method to build a new hashtag with a string identifier. Equivalent to setting the
`stringRepresentation` property.
@param hashtagString The hashtag string.
- Parameter hashtagString: The hashtag string.
*/
+ (instancetype)hashtagWithString:(NSString *)hashtagString;
/*!
@abstract The hashtag string.
@discussion You are responsible for making sure that `stringRepresentation` is a valid hashtag (a single '#' followed
/**
The hashtag string.
You are responsible for making sure that `stringRepresentation` is a valid hashtag (a single '#' followed
by one or more word characters). Invalid hashtags are ignored when sharing content. You can check validity with the
`valid` property.
@return The hashtag string.
- Returns: The hashtag string.
*/
@property (nonatomic, readwrite, copy) NSString *stringRepresentation;
/*!
@abstract Tests if a hashtag is valid.
@discussion A valid hashtag matches the regular expression "#\w+": A single '#' followed by one or more
/**
Tests if a hashtag is valid.
A valid hashtag matches the regular expression "#\w+": A single '#' followed by one or more
word characters.
@return YES if the hashtag is valid, NO otherwise.
- Returns: YES if the hashtag is valid, NO otherwise.
*/
@property (nonatomic, readonly, assign, getter=isValid) BOOL valid;
/*!
@abstract Compares the receiver to another hashtag.
@param hashtag The other hashtag
@return YES if the receiver is equal to the other hashtag; otherwise NO
/**
Compares the receiver to another hashtag.
- Parameter hashtag: The other hashtag
- Returns: YES if the receiver is equal to the other hashtag; otherwise NO
*/
- (BOOL)isEqualToHashtag:(FBSDKHashtag *)hashtag;
@@ -20,20 +20,21 @@
#import <FBSDKCoreKit/FBSDKButton.h>
#import "FBSDKLikeObjectType.h"
#import "FBSDKLiking.h"
#import <FBSDKShareKit/FBSDKLikeObjectType.h>
#import <FBSDKShareKit/FBSDKLiking.h>
/*!
@abstract A button to like an object.
@discussion Tapping the receiver will invoke an API call to the Facebook app through a fast-app-switch that allows
/**
A button to like an object.
Tapping the receiver will invoke an API call to the Facebook app through a fast-app-switch that allows
the object to be liked. Upon return to the calling app, the view will update with the new state. If the
currentAccessToken has "publish_actions" permission and the object is an Open Graph object, then the like can happen
seamlessly without the fast-app-switch.
*/
@interface FBSDKLikeButton : FBSDKButton <FBSDKLiking>
/*!
@abstract If YES, a sound is played when the receiver is toggled.
/**
If YES, a sound is played when the receiver is toggled.
@default YES
*/
@@ -203,14 +203,14 @@
[self _ensureLikeActionController:YES];
[_likeActionController toggleLikeWithSoundEnabled:self.soundEnabled
analyticsParameters:[self analyticsParameters]
fromViewController:[FBSDKInternalUtility viewControllerforView:self]];
fromViewController:[FBSDKInternalUtility viewControllerForView:self]];
}
- (void)_like:(id)sender
{
[_likeActionController toggleLikeWithSoundEnabled:_soundEnabled
analyticsParameters:[self analyticsParameters]
fromViewController:[FBSDKInternalUtility viewControllerforView:self]];
fromViewController:[FBSDKInternalUtility viewControllerForView:self]];
}
- (void)_likeActionControllerDidDisableNotification:(NSNotification *)notification
@@ -20,117 +20,121 @@
#import <FBSDKCoreKit/FBSDKMacros.h>
#import "FBSDKLikeObjectType.h"
#import "FBSDKLiking.h"
#import <FBSDKShareKit/FBSDKLikeObjectType.h>
#import <FBSDKShareKit/FBSDKLiking.h>
/*!
@typedef NS_ENUM (NSUInteger, FBSDKLikeControlAuxiliaryPosition)
/**
NS_ENUM (NSUInteger, FBSDKLikeControlAuxiliaryPosition)
@abstract Specifies the position of the auxiliary view relative to the like button.
Specifies the position of the auxiliary view relative to the like button.
*/
typedef NS_ENUM(NSUInteger, FBSDKLikeControlAuxiliaryPosition)
{
/*! The auxiliary view is inline with the like button. */
/** The auxiliary view is inline with the like button. */
FBSDKLikeControlAuxiliaryPositionInline,
/*! The auxiliary view is above the like button. */
/** The auxiliary view is above the like button. */
FBSDKLikeControlAuxiliaryPositionTop,
/*! The auxiliary view is below the like button. */
/** The auxiliary view is below the like button. */
FBSDKLikeControlAuxiliaryPositionBottom,
};
/*!
@abstract Converts an FBSDKLikeControlAuxiliaryPosition to an NSString.
/**
Converts an FBSDKLikeControlAuxiliaryPosition to an NSString.
*/
FBSDK_EXTERN NSString *NSStringFromFBSDKLikeControlAuxiliaryPosition(FBSDKLikeControlAuxiliaryPosition auxiliaryPosition);
/*!
@typedef NS_ENUM(NSUInteger, FBSDKLikeControlHorizontalAlignment)
/**
NS_ENUM(NSUInteger, FBSDKLikeControlHorizontalAlignment)
@abstract Specifies the horizontal alignment for FBSDKLikeControlStyleStandard with
Specifies the horizontal alignment for FBSDKLikeControlStyleStandard with
FBSDKLikeControlAuxiliaryPositionTop or FBSDKLikeControlAuxiliaryPositionBottom.
*/
typedef NS_ENUM(NSUInteger, FBSDKLikeControlHorizontalAlignment)
{
/*! The subviews are left aligned. */
/** The subviews are left aligned. */
FBSDKLikeControlHorizontalAlignmentLeft,
/*! The subviews are center aligned. */
/** The subviews are center aligned. */
FBSDKLikeControlHorizontalAlignmentCenter,
/*! The subviews are right aligned. */
/** The subviews are right aligned. */
FBSDKLikeControlHorizontalAlignmentRight,
};
/*!
@abstract Converts an FBSDKLikeControlHorizontalAlignment to an NSString.
/**
Converts an FBSDKLikeControlHorizontalAlignment to an NSString.
*/
FBSDK_EXTERN NSString *NSStringFromFBSDKLikeControlHorizontalAlignment(FBSDKLikeControlHorizontalAlignment horizontalAlignment);
/*!
@typedef NS_ENUM (NSUInteger, FBSDKLikeControlStyle)
/**
NS_ENUM (NSUInteger, FBSDKLikeControlStyle)
@abstract Specifies the style of a like control.
Specifies the style of a like control.
*/
typedef NS_ENUM(NSUInteger, FBSDKLikeControlStyle)
{
/*! Displays the button and the social sentence. */
/** Displays the button and the social sentence. */
FBSDKLikeControlStyleStandard = 0,
/*! Displays the button and a box that contains the like count. */
/** Displays the button and a box that contains the like count. */
FBSDKLikeControlStyleBoxCount,
};
/*!
@abstract Converts an FBSDKLikeControlStyle to an NSString.
/**
Converts an FBSDKLikeControlStyle to an NSString.
*/
FBSDK_EXTERN NSString *NSStringFromFBSDKLikeControlStyle(FBSDKLikeControlStyle style);
/*!
@class FBSDKLikeControl
/**
@abstract UI control to like an object in the Facebook graph.
UI control to like an object in the Facebook graph.
@discussion Taps on the like button within this control will invoke an API call to the Facebook app through a
Taps on the like button within this control will invoke an API call to the Facebook app through a
fast-app-switch that allows the user to like the object. Upon return to the calling app, the view will update
with the new state and send actions for the UIControlEventValueChanged event.
*/
@interface FBSDKLikeControl : UIControl <FBSDKLiking>
/*!
@abstract The foreground color to use for the content of the receiver.
/**
The foreground color to use for the content of the receiver.
*/
@property (nonatomic, strong) UIColor *foregroundColor;
/*!
@abstract The position for the auxiliary view for the receiver.
/**
The position for the auxiliary view for the receiver.
@see FBSDKLikeControlAuxiliaryPosition
- See:FBSDKLikeControlAuxiliaryPosition
*/
@property (nonatomic, assign) FBSDKLikeControlAuxiliaryPosition likeControlAuxiliaryPosition;
/*!
@abstract The text alignment of the social sentence.
/**
The text alignment of the social sentence.
@discussion This value is only valid for FBSDKLikeControlStyleStandard with
This value is only valid for FBSDKLikeControlStyleStandard with
FBSDKLikeControlAuxiliaryPositionTop|Bottom.
*/
@property (nonatomic, assign) FBSDKLikeControlHorizontalAlignment likeControlHorizontalAlignment;
/*!
@abstract The style to use for the receiver.
/**
The style to use for the receiver.
@see FBSDKLikeControlStyle
- See:FBSDKLikeControlStyle
*/
@property (nonatomic, assign) FBSDKLikeControlStyle likeControlStyle;
/*!
@abstract The preferred maximum width (in points) for autolayout.
/**
The preferred maximum width (in points) for autolayout.
@discussion This property affects the size of the receiver when layout constraints are applied to it. During layout,
This property affects the size of the receiver when layout constraints are applied to it. During layout,
if the text extends beyond the width specified by this property, the additional text is flowed to one or more new
lines, thereby increasing the height of the receiver.
*/
@property (nonatomic, assign) CGFloat preferredMaxLayoutWidth;
/*!
@abstract If YES, a sound is played when the receiver is toggled.
/**
If YES, a sound is played when the receiver is toggled.
@default YES
*/
@@ -20,21 +20,21 @@
#import <FBSDKCoreKit/FBSDKMacros.h>
/*!
@typedef NS_ENUM (NSUInteger, FBSDKLikeObjectType)
@abstract Specifies the type of object referenced by the objectID for likes.
/**
NS_ENUM (NSUInteger, FBSDKLikeObjectType)
Specifies the type of object referenced by the objectID for likes.
*/
typedef NS_ENUM(NSUInteger, FBSDKLikeObjectType)
{
/*! The objectID refers to an unknown object type. */
/** The objectID refers to an unknown object type. */
FBSDKLikeObjectTypeUnknown = 0,
/*! The objectID refers to an Open Graph object. */
/** The objectID refers to an Open Graph object. */
FBSDKLikeObjectTypeOpenGraph,
/*! The objectID refers to an Page object. */
/** The objectID refers to an Page object. */
FBSDKLikeObjectTypePage,
};
/*!
@abstract Converts an FBLikeControlObjectType to an NSString.
/**
Converts an FBLikeControlObjectType to an NSString.
*/
FBSDK_EXTERN NSString *NSStringFromFBSDKLikeObjectType(FBSDKLikeObjectType objectType);
@@ -18,25 +18,29 @@
#import <Foundation/Foundation.h>
/*!
@abstract The common interface for components that initiate liking.
@see FBSDKLikeButton
@see FBSDKLikeControl
/**
The common interface for components that initiate liking.
- See:FBSDKLikeButton
- See:FBSDKLikeControl
*/
@protocol FBSDKLiking <NSObject>
/*!
@abstract The objectID for the object to like.
/**
The objectID for the object to like.
@discussion This value may be an Open Graph object ID or a string representation of an URL that describes an
This value may be an Open Graph object ID or a string representation of an URL that describes an
Open Graph object. The objects may be public objects, like pages, or objects that are defined by your application.
*/
@property (nonatomic, copy) NSString *objectID;
/*!
@abstract The type of object referenced by the objectID.
/**
The type of object referenced by the objectID.
@discussion If the objectType is unknown, the control will determine the objectType by querying the server with the
If the objectType is unknown, the control will determine the objectType by querying the server with the
objectID. Specifying a value for the objectType is an optimization that should be used if the type is known by the
consumer. Consider setting the objectType if it is known when setting the objectID.
*/
@@ -18,17 +18,17 @@
#import <Foundation/Foundation.h>
#import "FBSDKSharing.h"
#import <FBSDKShareKit/FBSDKSharing.h>
/*!
@abstract A dialog for sharing content through Messenger.
/**
A dialog for sharing content through Messenger.
*/
@interface FBSDKMessageDialog : NSObject <FBSDKSharingDialog>
/*!
@abstract Convenience method to show a Message Share Dialog with content and a delegate.
@param content The content to be shared.
@param delegate The receiver's delegate.
/**
Convenience method to show a Message Share Dialog with content and a delegate.
- Parameter content: The content to be shared.
- Parameter delegate: The receiver's delegate.
*/
+ (instancetype)showWithContent:(id<FBSDKSharingContent>)content delegate:(id<FBSDKSharingDelegate>)delegate;
@@ -20,11 +20,12 @@
#import <FBSDKCoreKit/FBSDKButton.h>
#import "FBSDKSharingButton.h"
#import <FBSDKShareKit/FBSDKSharingButton.h>
/*!
@abstract A button to send content through Messenger.
@discussion Tapping the receiver will invoke the FBSDKShareDialog with the attached shareContent. If the dialog cannot
/**
A button to send content through Messenger.
Tapping the receiver will invoke the FBSDKShareDialog with the attached shareContent. If the dialog cannot
be shown, the button will be disable.
*/
@interface FBSDKSendButton : FBSDKButton <FBSDKSharingButton>
@@ -18,61 +18,76 @@
#import <Foundation/Foundation.h>
#import "FBSDKShareOpenGraphObject.h"
#import "FBSDKSharing.h"
#import <FBSDKCoreKit/FBSDKAccessToken.h>
/*!
@abstract A utility class for sharing through the graph API. Using this class requires an access token in
[FBSDKAccessToken currentAccessToken] that has been granted the "publish_actions" permission.
@discussion FBSDKShareAPI network requests are scheduled on the current run loop in the default run loop mode
#import <FBSDKShareKit/FBSDKShareOpenGraphObject.h>
#import <FBSDKShareKit/FBSDKSharing.h>
/**
A utility class for sharing through the graph API. Using this class requires an access token that
has been granted the "publish_actions" permission.
FBSDKShareAPI network requests are scheduled on the current run loop in the default run loop mode
(like NSURLConnection). If you want to use FBSDKShareAPI in a background thread, you must manage the run loop
yourself.
*/
@interface FBSDKShareAPI : NSObject <FBSDKSharing>
/*!
@abstract Convenience method to build up a share API with content and a delegate.
@param content The content to be shared.
@param delegate The receiver's delegate.
/**
Convenience method to build up a share API with content and a delegate.
- Parameter content: The content to be shared.
- Parameter delegate: The receiver's delegate.
*/
+ (instancetype)shareWithContent:(id<FBSDKSharingContent>)content delegate:(id<FBSDKSharingDelegate>)delegate;
/*!
@abstract The message the person has provided through the custom dialog that will accompany the share content.
/**
The message the person has provided through the custom dialog that will accompany the share content.
*/
@property (nonatomic, copy) NSString *message;
/*!
@abstract The graph node to which content should be shared.
/**
The graph node to which content should be shared.
*/
@property (nonatomic, copy) NSString *graphNode;
/*!
@abstract A Boolean value that indicates whether the receiver can send the share.
@discussion May return NO if the appropriate Facebook app is not installed and is required or an access token is
/**
The access token used when performing a share. The access token must have the "publish_actions"
permission granted.
Defaults to [FBSDKAccessToken currentAccessToken]. Setting this to nil will revert the access token to
[FBSDKAccessToken currentAccessToken].
*/
@property (nonatomic, strong) FBSDKAccessToken *accessToken;
/**
A Boolean value that indicates whether the receiver can send the share.
May return NO if the appropriate Facebook app is not installed and is required or an access token is
required but not available. This method does not validate the content on the receiver, so this can be checked before
building up the content.
@see [FBSDKSharing validateWithError:]
@result YES if the receiver can send, otherwise NO.
- See:[FBSDKSharing validateWithError:]
- Returns: YES if the receiver can send, otherwise NO.
*/
- (BOOL)canShare;
/*!
@abstract Creates an User Owned Open Graph object without an action.
@param openGraphObject The open graph object to create.
@discussion Use this method to create an object alone, when an action is not going to be posted with the object. If
/**
Creates an User Owned Open Graph object without an action.
- Parameter openGraphObject: The open graph object to create.
Use this method to create an object alone, when an action is not going to be posted with the object. If
the object will be used within an action, just put the object in the action and share that as the shareContent and the
object will be created in the process. The delegate will be messaged with the results.
Also see https://developers.facebook.com/docs/sharing/opengraph/object-api#objectapi-creatinguser
@result YES if the receiver was able to send the request to create the object, otherwise NO.
- Returns: YES if the receiver was able to send the request to create the object, otherwise NO.
*/
- (BOOL)createOpenGraphObject:(FBSDKShareOpenGraphObject *)openGraphObject;
/*!
@abstract Begins the send from the receiver.
@result YES if the receiver was able to send the share, otherwise NO.
/**
Begins the send from the receiver.
- Returns: YES if the receiver was able to send the share, otherwise NO.
*/
- (BOOL)share;
@@ -22,7 +22,6 @@
#import <AssetsLibrary/AssetsLibrary.h>
#endif
#import <FBSDKCoreKit/FBSDKAccessToken.h>
#import <FBSDKCoreKit/FBSDKGraphRequest.h>
#import <FBSDKCoreKit/FBSDKGraphRequestDataAttachment.h>
@@ -72,6 +71,7 @@ static NSMutableArray *g_pendingFBSDKShareAPI;
@synthesize delegate = _delegate;
@synthesize shareContent = _shareContent;
@synthesize shouldFailOnDataError = _shouldFailOnDataError;
@synthesize accessToken = _accessToken;
#pragma mark - Object Lifecycle
@@ -118,7 +118,7 @@ static NSMutableArray *g_pendingFBSDKShareAPI;
return NO;
}
if (![self _hasPublishActions]) {
NSString *message = @"Warning: [FBSDKAccessToken currentAccessToken] is missing publish_actions permissions";
NSString *message = @"Warning: Access token is missing publish_actions permissions";
[FBSDKLogger singleShotLogEntry:FBSDKLoggingBehaviorDeveloperErrors logEntry:message];
}
if (!openGraphObject) {
@@ -151,7 +151,7 @@ static NSMutableArray *g_pendingFBSDKShareAPI;
return NO;
}
if (![self _hasPublishActions]) {
NSString *message = @"Warning: [FBSDKAccessToken currentAccessToken] is missing publish_actions permissions";
NSString *message = @"Warning: Access token is missing publish_actions permissions";
[FBSDKLogger singleShotLogEntry:FBSDKLoggingBehaviorDeveloperErrors logEntry:message];
}
if (![self validateWithError:&error]) {
@@ -202,6 +202,11 @@ static NSMutableArray *g_pendingFBSDKShareAPI;
return [FBSDKShareUtility validateShareContent:shareContent error:errorRef];
}
- (FBSDKAccessToken *)accessToken
{
return _accessToken ?: [FBSDKAccessToken currentAccessToken];
}
#pragma mark - Helper Methods
- (NSString *)_graphPathWithSuffix:(NSString *)suffix, ... NS_REQUIRES_NIL_TERMINATION
@@ -238,8 +243,7 @@ static NSMutableArray *g_pendingFBSDKShareAPI;
- (BOOL)_hasPublishActions
{
FBSDKAccessToken *accessToken = [FBSDKAccessToken currentAccessToken];
return [accessToken.permissions containsObject:@"publish_actions"];
return [self.accessToken.permissions containsObject:@"publish_actions"];
}
- (BOOL)_shareLinkContent:(FBSDKShareLinkContent *)linkContent
@@ -270,6 +274,8 @@ static NSMutableArray *g_pendingFBSDKShareAPI;
[[[FBSDKGraphRequest alloc] initWithGraphPath:[self _graphPathWithSuffix:@"feed", nil]
parameters:parameters
tokenString:self.accessToken.tokenString
version:nil
HTTPMethod:@"POST"] startWithCompletionHandler:completionHandler];
return YES;
}
@@ -310,6 +316,8 @@ static NSMutableArray *g_pendingFBSDKShareAPI;
NSString *graphPath = [self _graphPathWithSuffix:[FBSDKUtility URLEncode:action.actionType], nil];
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:graphPath
parameters:parameters
tokenString:self.accessToken.tokenString
version:nil
HTTPMethod:@"POST"];
[self _connection:connection addRequest:request completionHandler:requestHandler];
[connection start];
@@ -338,6 +346,8 @@ static NSMutableArray *g_pendingFBSDKShareAPI;
parameters[@"picture"] = image;
[requests addObject:[[FBSDKGraphRequest alloc] initWithGraphPath:graphPath
parameters:parameters
tokenString:self.accessToken.tokenString
version:nil
HTTPMethod:@"POST"]];
}
}
@@ -358,6 +368,7 @@ static NSMutableArray *g_pendingFBSDKShareAPI;
if ([errors count]) {
[_delegate sharer:self didFailWithError:errors[0]];
} else if ([results count]) {
NSArray *individualPhotoIDs = [results valueForKeyPath:@"id"];
// each photo upload will be merged into the same post, so grab the post_id from the first and use that
NSMutableDictionary *shareResults = [[NSMutableDictionary alloc] init];
[FBSDKInternalUtility dictionary:shareResults setObject:FBSDK_SHARE_RESULT_COMPLETION_GESTURE_VALUE_POST
@@ -365,6 +376,7 @@ static NSMutableArray *g_pendingFBSDKShareAPI;
NSDictionary *firstResult = [FBSDKTypeUtility dictionaryValue:results[0]];
[FBSDKInternalUtility dictionary:shareResults setObject:[FBSDKTypeUtility stringValue:firstResult[@"post_id"]]
forKey:FBSDK_SHARE_RESULT_POST_ID_KEY];
[FBSDKInternalUtility dictionary:shareResults setObject:individualPhotoIDs forKey:FBSDK_SHARE_RESULT_PHOTO_IDS_KEY];
[_delegate sharer:self didCompleteWithResults:shareResults];
}
};
@@ -379,7 +391,7 @@ static NSMutableArray *g_pendingFBSDKShareAPI;
NSMutableDictionary *parameters = [[NSMutableDictionary alloc] init];
[self _addCommonParameters:parameters content:videoContent];
[FBSDKInternalUtility dictionary:parameters setObject:self.message forKey:@"description"];
if ([[FBSDKAccessToken currentAccessToken].permissions containsObject:@"ads_management"]) {
if ([self.accessToken.permissions containsObject:@"ads_management"]) {
FBSDKSharePhoto *photo = videoContent.previewPhoto;
UIImage *image = photo.image;
if (!image && [photo.imageURL isFileURL]) {
@@ -403,6 +415,7 @@ static NSMutableArray *g_pendingFBSDKShareAPI;
videoSize:(unsigned long)[_fileHandle seekToEndOfFile]
parameters:parameters
delegate:self];
videoUploader.graphNode = self.graphNode;
[videoUploader start];
return YES;
} else if (videoURL) {
@@ -419,6 +432,7 @@ static NSMutableArray *g_pendingFBSDKShareAPI;
videoSize:size
parameters:parameters
delegate:self];
videoUploader.graphNode = self.graphNode;
[videoUploader start];
} failureBlock:^(NSError *error) {
[_delegate sharer:self didFailWithError:error];
@@ -545,12 +559,11 @@ static NSMutableArray *g_pendingFBSDKShareAPI;
[_delegate sharer:self didFailWithError:JSONError];
return;
}
NSString *tokenString = [FBSDKAccessToken currentAccessToken].tokenString;
NSString *graphPath = [self _graphPathWithSuffix:@"objects", type, nil];
NSDictionary *parameters = @{ @"object": objectString };
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:graphPath
parameters:parameters
tokenString:tokenString
tokenString:self.accessToken.tokenString
version:nil
HTTPMethod:@"POST"];
FBSDKGraphRequestHandler requestCompletionHandler = ^(FBSDKGraphRequestConnection *requestConnection,
@@ -661,6 +674,8 @@ static NSMutableArray *g_pendingFBSDKShareAPI;
NSDictionary *parameters = @{ @"file": photo.image };
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:graphPath
parameters:parameters
tokenString:self.accessToken.tokenString
version:nil
HTTPMethod:@"POST"];
FBSDKGraphRequestHandler completionHandler = ^(FBSDKGraphRequestConnection *requestConnection,
id result,
@@ -20,11 +20,12 @@
#import <FBSDKCoreKit/FBSDKButton.h>
#import "FBSDKSharingButton.h"
#import <FBSDKShareKit/FBSDKSharingButton.h>
/*!
@abstract A button to share content.
@discussion Tapping the receiver will invoke the FBSDKShareDialog with the attached shareContent. If the dialog cannot
/**
A button to share content.
Tapping the receiver will invoke the FBSDKShareDialog with the attached shareContent. If the dialog cannot
be shown, the button will be disabled.
*/
@interface FBSDKShareButton : FBSDKButton <FBSDKSharingButton>
@@ -20,35 +20,37 @@
#import <FBSDKCoreKit/FBSDKMacros.h>
/*!
@abstract The error domain for all errors from FBSDKShareKit.
@discussion Error codes from the SDK in the range 200-299 are reserved for this domain.
/**
The error domain for all errors from FBSDKShareKit.
Error codes from the SDK in the range 200-299 are reserved for this domain.
*/
FBSDK_EXTERN NSString *const FBSDKShareErrorDomain;
/*!
@typedef NS_ENUM(NSInteger, FBSDKShareErrorCode)
@abstract Error codes for FBSDKShareErrorDomain.
/**
NS_ENUM(NSInteger, FBSDKShareErrorCode)
Error codes for FBSDKShareErrorDomain.
*/
typedef NS_ENUM(NSInteger, FBSDKShareErrorCode)
{
/*!
@abstract Reserved.
/**
Reserved.
*/
FBSDKShareReservedErrorCode = 200,
/*!
@abstract The error code for errors from uploading open graph objects.
/**
The error code for errors from uploading open graph objects.
*/
FBSDKShareOpenGraphErrorCode,
/*!
@abstract The error code for when a sharing dialog is not available.
@discussion Use the canShare methods to check for this case before calling show.
/**
The error code for when a sharing dialog is not available.
Use the canShare methods to check for this case before calling show.
*/
FBSDKShareDialogNotAvailableErrorCode,
/*!
/**
@The error code for unknown errors.
*/
FBSDKShareUnknownErrorCode,
@@ -18,34 +18,36 @@
#import <UIKit/UIKit.h>
#import "FBSDKShareDialogMode.h"
#import "FBSDKSharing.h"
#import "FBSDKSharingContent.h"
#import <FBSDKShareKit/FBSDKShareDialogMode.h>
#import <FBSDKShareKit/FBSDKSharing.h>
#import <FBSDKShareKit/FBSDKSharingContent.h>
/*!
@abstract A dialog for sharing content on Facebook.
/**
A dialog for sharing content on Facebook.
*/
@interface FBSDKShareDialog : NSObject <FBSDKSharingDialog>
/*!
@abstract Convenience method to show an FBSDKShareDialog with a fromViewController, content and a delegate.
@param viewController A UIViewController to present the dialog from, if appropriate.
@param content The content to be shared.
@param delegate The receiver's delegate.
/**
Convenience method to show an FBSDKShareDialog with a fromViewController, content and a delegate.
- Parameter viewController: A UIViewController to present the dialog from, if appropriate.
- Parameter content: The content to be shared.
- Parameter delegate: The receiver's delegate.
*/
+ (instancetype)showFromViewController:(UIViewController *)viewController
withContent:(id<FBSDKSharingContent>)content
delegate:(id<FBSDKSharingDelegate>)delegate;
/*!
@abstract A UIViewController to present the dialog from.
@discussion If not specified, the top most view controller will be automatically determined as best as possible.
/**
A UIViewController to present the dialog from.
If not specified, the top most view controller will be automatically determined as best as possible.
*/
@property (nonatomic, weak) UIViewController *fromViewController;
/*!
@abstract The mode with which to display the dialog.
@discussion Defaults to FBSDKShareDialogModeAutomatic, which will automatically choose the best available mode.
/**
The mode with which to display the dialog.
Defaults to FBSDKShareDialogModeAutomatic, which will automatically choose the best available mode.
*/
@property (nonatomic, assign) FBSDKShareDialogMode mode;
@@ -188,6 +188,14 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
NSInteger errorCode = [results[@"error_code"] integerValue];
if (errorCode == 4201) {
[self _invokeDelegateDidCancel];
} else if (errorCode != 0) {
NSError *error = [FBSDKShareError errorWithCode:FBSDKShareUnknownErrorCode
userInfo:@{
FBSDKGraphRequestErrorGraphErrorCode : @(errorCode)
}
message:results[@"error_message"]
underlyingError:nil];
[self _handleWebResponseParameters:nil error:error];
} else {
// not all web dialogs report cancellation, so assume that the share has completed with no additional information
[self _handleWebResponseParameters:results error:nil];
@@ -446,6 +454,16 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
}
}
- (BOOL)_photoContentHasAtLeastOneImage:(FBSDKSharePhotoContent *)photoContent
{
for (FBSDKSharePhoto *photo in photoContent.photos) {
if (photo.image != nil) {
return YES;
}
}
return NO;
}
- (BOOL)_showBrowser:(NSError **)errorRef
{
if (![self _validateShareContentForBrowser:errorRef]) {
@@ -454,27 +472,53 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
id<FBSDKSharingContent> shareContent = self.shareContent;
NSString *methodName;
NSDictionary *parameters;
if (![FBSDKShareUtility buildWebShareContent:shareContent
methodName:&methodName
parameters:&parameters
error:errorRef]) {
return NO;
if ([shareContent isKindOfClass:[FBSDKSharePhotoContent class]] && [self _photoContentHasAtLeastOneImage:(FBSDKSharePhotoContent *)shareContent]) {
void(^completion)(BOOL, NSString *, NSDictionary *) = ^(BOOL successfullyBuilt, NSString *cMethodName, NSDictionary *cParameters) {
if (successfullyBuilt) {
FBSDKBridgeAPICallbackBlock completionBlock = ^(FBSDKBridgeAPIResponse *response) {
[self _handleWebResponseParameters:response.responseParameters error:response.error];
[FBSDKInternalUtility unregisterTransientObject:self];
};
FBSDKBridgeAPIRequest *request;
request = [FBSDKBridgeAPIRequest bridgeAPIRequestWithProtocolType:FBSDKBridgeAPIProtocolTypeWeb
scheme:FBSDK_SHARE_WEB_SCHEME
methodName:cMethodName
methodVersion:nil
parameters:cParameters
userInfo:nil];
[[FBSDKApplicationDelegate sharedInstance] openBridgeAPIRequest:request
useSafariViewController:[self _useSafariViewController]
fromViewController:self.fromViewController
completionBlock:completionBlock];
}
};
[FBSDKShareUtility buildAsyncWebPhotoContent:shareContent
completionHandler:completion];
} else {
if (![FBSDKShareUtility buildWebShareContent:shareContent
methodName:&methodName
parameters:&parameters
error:errorRef]) {
return NO;
}
FBSDKBridgeAPICallbackBlock completionBlock = ^(FBSDKBridgeAPIResponse *response) {
[self _handleWebResponseParameters:response.responseParameters error:response.error];
[FBSDKInternalUtility unregisterTransientObject:self];
};
FBSDKBridgeAPIRequest *request;
request = [FBSDKBridgeAPIRequest bridgeAPIRequestWithProtocolType:FBSDKBridgeAPIProtocolTypeWeb
scheme:FBSDK_SHARE_WEB_SCHEME
methodName:methodName
methodVersion:nil
parameters:parameters
userInfo:nil];
[[FBSDKApplicationDelegate sharedInstance] openBridgeAPIRequest:request
useSafariViewController:[self _useSafariViewController]
fromViewController:self.fromViewController
completionBlock:completionBlock];
}
FBSDKBridgeAPICallbackBlock completionBlock = ^(FBSDKBridgeAPIResponse *response) {
[self _handleWebResponseParameters:response.responseParameters error:response.error];
[FBSDKInternalUtility unregisterTransientObject:self];
};
FBSDKBridgeAPIRequest *request;
request = [FBSDKBridgeAPIRequest bridgeAPIRequestWithProtocolType:FBSDKBridgeAPIProtocolTypeWeb
scheme:FBSDK_SHARE_WEB_SCHEME
methodName:methodName
methodVersion:nil
parameters:parameters
userInfo:nil];
[[FBSDKApplicationDelegate sharedInstance] openBridgeAPIRequest:request
useSafariViewController:[self _useSafariViewController]
fromViewController:self.fromViewController
completionBlock:completionBlock];
return YES;
}
@@ -773,12 +817,24 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
BOOL containsPhotos;
[FBSDKShareUtility testShareContent:shareContent containsMedia:&containsMedia containsPhotos:&containsPhotos containsVideos:NULL];
if (containsPhotos) {
if ((errorRef != NULL) && !*errorRef) {
*errorRef = [FBSDKShareError invalidArgumentErrorWithName:@"shareContent"
value:shareContent
message:@"Web share dialogs cannot include photos."];
if ([shareContent isKindOfClass:[FBSDKSharePhotoContent class]]) {
if ([FBSDKAccessToken currentAccessToken] != nil) {
return YES;
}
if ((errorRef != NULL) && !*errorRef) {
*errorRef = [FBSDKShareError invalidArgumentErrorWithName:@"shareContent"
value:shareContent
message:@"The web share dialog needs a valid access token to stage photos."];
}
return NO;
} else {
if ((errorRef != NULL) && !*errorRef) {
*errorRef = [FBSDKShareError invalidArgumentErrorWithName:@"shareContent"
value:shareContent
message:@"Web share dialogs cannot include photos."];
}
return NO;
}
return NO;
}
if (containsMedia) {
if ((errorRef != NULL) && !*errorRef) {
@@ -828,7 +884,7 @@ FBSDK_STATIC_INLINE void FBSDKShareDialogValidateShareExtensionSchemeRegisteredF
{
id<FBSDKSharingContent> shareContent = self.shareContent;
if ([shareContent isKindOfClass:[FBSDKSharePhotoContent class]]) {
if ([self _contentImages] != 0) {
if ([self _contentImages].count != 0) {
return YES;
} else {
if ((errorRef != NULL) && !*errorRef) {
@@ -20,45 +20,46 @@
#import <FBSDKCoreKit/FBSDKMacros.h>
/*!
@typedef NS_ENUM(NSUInteger, FBSDKShareDialogMode)
@abstract Modes for the FBSDKShareDialog.
@discussion The automatic mode will progressively check the availability of different modes and open the most
/**
NS_ENUM(NSUInteger, FBSDKShareDialogMode)
Modes for the FBSDKShareDialog.
The automatic mode will progressively check the availability of different modes and open the most
appropriate mode for the dialog that is available.
*/
typedef NS_ENUM(NSUInteger, FBSDKShareDialogMode)
{
/*!
@abstract Acts with the most appropriate mode that is available.
/**
Acts with the most appropriate mode that is available.
*/
FBSDKShareDialogModeAutomatic = 0,
/*!
/**
@Displays the dialog in the main native Facebook app.
*/
FBSDKShareDialogModeNative,
/*!
/**
@Displays the dialog in the iOS integrated share sheet.
*/
FBSDKShareDialogModeShareSheet,
/*!
/**
@Displays the dialog in Safari.
*/
FBSDKShareDialogModeBrowser,
/*!
/**
@Displays the dialog in a UIWebView within the app.
*/
FBSDKShareDialogModeWeb,
/*!
/**
@Displays the feed dialog in Safari.
*/
FBSDKShareDialogModeFeedBrowser,
/*!
/**
@Displays the feed dialog in a UIWebView within the app.
*/
FBSDKShareDialogModeFeedWeb,
};
/*!
@abstract Converts an FBLikeControlObjectType to an NSString.
/**
Converts an FBLikeControlObjectType to an NSString.
*/
FBSDK_EXTERN NSString *NSStringFromFBSDKShareDialogMode(FBSDKShareDialogMode dialogMode);
@@ -18,38 +18,38 @@
#import <UIKit/UIKit.h>
#import "FBSDKHashtag.h"
#import "FBSDKShareAPI.h"
#import "FBSDKShareConstants.h"
#import "FBSDKShareLinkContent.h"
#import "FBSDKShareOpenGraphAction.h"
#import "FBSDKShareOpenGraphContent.h"
#import "FBSDKShareOpenGraphObject.h"
#import "FBSDKSharePhoto.h"
#import "FBSDKSharePhotoContent.h"
#import "FBSDKShareVideo.h"
#import "FBSDKShareVideoContent.h"
#import "FBSDKSharing.h"
#import "FBSDKSharingContent.h"
#import <FBSDKShareKit/FBSDKHashtag.h>
#import <FBSDKShareKit/FBSDKShareAPI.h>
#import <FBSDKShareKit/FBSDKShareConstants.h>
#import <FBSDKShareKit/FBSDKShareLinkContent.h>
#import <FBSDKShareKit/FBSDKShareOpenGraphAction.h>
#import <FBSDKShareKit/FBSDKShareOpenGraphContent.h>
#import <FBSDKShareKit/FBSDKShareOpenGraphObject.h>
#import <FBSDKShareKit/FBSDKSharePhoto.h>
#import <FBSDKShareKit/FBSDKSharePhotoContent.h>
#import <FBSDKShareKit/FBSDKShareVideo.h>
#import <FBSDKShareKit/FBSDKShareVideoContent.h>
#import <FBSDKShareKit/FBSDKSharing.h>
#import <FBSDKShareKit/FBSDKSharingContent.h>
#if !TARGET_OS_TV
#import "FBSDKAppGroupAddDialog.h"
#import "FBSDKAppGroupContent.h"
#import "FBSDKAppGroupJoinDialog.h"
#import "FBSDKAppInviteContent.h"
#import "FBSDKAppInviteDialog.h"
#import "FBSDKGameRequestContent.h"
#import "FBSDKGameRequestDialog.h"
#import "FBSDKLikeButton.h"
#import "FBSDKLikeControl.h"
#import "FBSDKLikeObjectType.h"
#import "FBSDKMessageDialog.h"
#import "FBSDKShareButton.h"
#import "FBSDKShareDialog.h"
#import "FBSDKShareDialogMode.h"
#import "FBSDKShareMediaContent.h"
#import "FBSDKSendButton.h"
#import <FBSDKShareKit/FBSDKAppGroupAddDialog.h>
#import <FBSDKShareKit/FBSDKAppGroupContent.h>
#import <FBSDKShareKit/FBSDKAppGroupJoinDialog.h>
#import <FBSDKShareKit/FBSDKAppInviteContent.h>
#import <FBSDKShareKit/FBSDKAppInviteDialog.h>
#import <FBSDKShareKit/FBSDKGameRequestContent.h>
#import <FBSDKShareKit/FBSDKGameRequestDialog.h>
#import <FBSDKShareKit/FBSDKLikeButton.h>
#import <FBSDKShareKit/FBSDKLikeControl.h>
#import <FBSDKShareKit/FBSDKLikeObjectType.h>
#import <FBSDKShareKit/FBSDKMessageDialog.h>
#import <FBSDKShareKit/FBSDKShareButton.h>
#import <FBSDKShareKit/FBSDKShareDialog.h>
#import <FBSDKShareKit/FBSDKShareDialogMode.h>
#import <FBSDKShareKit/FBSDKShareMediaContent.h>
#import <FBSDKShareKit/FBSDKSendButton.h>
#else
#import "FBSDKDeviceShareViewController.h"
#import "FBSDKDeviceShareButton.h"
#import <FBSDKShareKit/FBSDKDeviceShareViewController.h>
#import <FBSDKShareKit/FBSDKDeviceShareButton.h>
#endif
@@ -18,45 +18,48 @@
#import <Foundation/Foundation.h>
#import "FBSDKSharingContent.h"
#import <FBSDKShareKit/FBSDKSharingContent.h>
/*!
@abstract A model for status and link content to be shared.
/**
A model for status and link content to be shared.
*/
@interface FBSDKShareLinkContent : NSObject <FBSDKSharingContent>
/*!
@abstract The description of the link.
@discussion If not specified, this field is automatically populated by information scraped from the contentURL,
/**
The description of the link.
If not specified, this field is automatically populated by information scraped from the contentURL,
typically the title of the page. This value may be discarded for specially handled links (ex: iTunes URLs).
@return The description of the link
- Returns: The description of the link
*/
@property (nonatomic, copy) NSString *contentDescription;
/*!
@abstract The title to display for this link.
@discussion This value may be discarded for specially handled links (ex: iTunes URLs).
@return The link title
/**
The title to display for this link.
This value may be discarded for specially handled links (ex: iTunes URLs).
- Returns: The link title
*/
@property (nonatomic, copy) NSString *contentTitle;
/*!
@abstract The URL of a picture to attach to this content.
@return The network URL of an image
/**
The URL of a picture to attach to this content.
- Returns: The network URL of an image
*/
@property (nonatomic, copy) NSURL *imageURL;
/*!
@abstract Some quote text of the link.
@discussion If specified, the quote text will render with custom styling on top of the link.
@return The quote text of a link
/**
Some quote text of the link.
If specified, the quote text will render with custom styling on top of the link.
- Returns: The quote text of a link
*/
@property (nonatomic, copy) NSString *quote;
/*!
@abstract Compares the receiver to another link content.
@param content The other content
@return YES if the receiver's values are equal to the other content's values; otherwise NO
/**
Compares the receiver to another link content.
- Parameter content: The other content
- Returns: YES if the receiver's values are equal to the other content's values; otherwise NO
*/
- (BOOL)isEqualToShareLinkContent:(FBSDKShareLinkContent *)content;
@@ -18,23 +18,23 @@
#import <Foundation/Foundation.h>
#import "FBSDKSharingContent.h"
#import <FBSDKShareKit/FBSDKSharingContent.h>
/*!
@abstract A model for media content (photo or video) to be shared.
/**
A model for media content (photo or video) to be shared.
*/
@interface FBSDKShareMediaContent : NSObject <FBSDKSharingContent>
/*!
@abstract Media to be shared.
@return Array of the media (FBSDKSharePhoto or FBSDKShareVideo)
/**
Media to be shared.
- Returns: Array of the media (FBSDKSharePhoto or FBSDKShareVideo)
*/
@property (nonatomic, copy) NSArray *media;
/*!
@abstract Compares the receiver to another media content.
@param content The other content
@return YES if the receiver's values are equal to the other content's values; otherwise NO
/**
Compares the receiver to another media content.
- Parameter content: The other content
- Returns: YES if the receiver's values are equal to the other content's values; otherwise NO
*/
- (BOOL)isEqualToShareMediaContent:(FBSDKShareMediaContent *)content;
@@ -20,49 +20,50 @@
#import <FBSDKCoreKit/FBSDKCopying.h>
#import "FBSDKShareOpenGraphObject.h"
#import "FBSDKShareOpenGraphValueContainer.h"
#import <FBSDKShareKit/FBSDKShareOpenGraphObject.h>
#import <FBSDKShareKit/FBSDKShareOpenGraphValueContainer.h>
/*!
@abstract An Open Graph Action for sharing.
@discussion The property keys MUST have namespaces specified on them, such as `og:image`.
/**
An Open Graph Action for sharing.
The property keys MUST have namespaces specified on them, such as `og:image`.
*/
@interface FBSDKShareOpenGraphAction : FBSDKShareOpenGraphValueContainer <FBSDKCopying, NSSecureCoding>
/*!
@abstract Convenience method to build a new action and set the object for the specified key.
@param actionType The action type of the receiver
@param object The Open Graph object represented by this action
@param key The key for the object
/**
Convenience method to build a new action and set the object for the specified key.
- Parameter actionType: The action type of the receiver
- Parameter object: The Open Graph object represented by this action
- Parameter key: The key for the object
*/
+ (instancetype)actionWithType:(NSString *)actionType object:(FBSDKShareOpenGraphObject *)object key:(NSString *)key;
/*!
@abstract Convenience method to build a new action and set the object for the specified key.
@param actionType The action type of the receiver
@param objectID The ID of an existing Open Graph object
@param key The key for the object
/**
Convenience method to build a new action and set the object for the specified key.
- Parameter actionType: The action type of the receiver
- Parameter objectID: The ID of an existing Open Graph object
- Parameter key: The key for the object
*/
+ (instancetype)actionWithType:(NSString *)actionType objectID:(NSString *)objectID key:(NSString *)key;
/*!
@abstract Convenience method to build a new action and set the object for the specified key.
@param actionType The action type of the receiver
@param objectURL The URL to a page that defines the Open Graph object with meta tags
@param key The key for the object
/**
Convenience method to build a new action and set the object for the specified key.
- Parameter actionType: The action type of the receiver
- Parameter objectURL: The URL to a page that defines the Open Graph object with meta tags
- Parameter key: The key for the object
*/
+ (instancetype)actionWithType:(NSString *)actionType objectURL:(NSURL *)objectURL key:(NSString *)key;
/*!
@abstract Gets the action type.
@return The action type
/**
Gets the action type.
- Returns: The action type
*/
@property (nonatomic, copy) NSString *actionType;
/*!
@abstract Compares the receiver to another Open Graph Action.
@param action The other action
@return YES if the receiver's values are equal to the other action's values; otherwise NO
/**
Compares the receiver to another Open Graph Action.
- Parameter action: The other action
- Returns: YES if the receiver's values are equal to the other action's values; otherwise NO
*/
- (BOOL)isEqualToShareOpenGraphAction:(FBSDKShareOpenGraphAction *)action;
@@ -18,31 +18,32 @@
#import <Foundation/Foundation.h>
#import "FBSDKShareOpenGraphAction.h"
#import "FBSDKSharingContent.h"
#import <FBSDKShareKit/FBSDKShareOpenGraphAction.h>
#import <FBSDKShareKit/FBSDKSharingContent.h>
/*!
@abstract A model for Open Graph content to be shared.
/**
A model for Open Graph content to be shared.
*/
@interface FBSDKShareOpenGraphContent : NSObject <FBSDKSharingContent>
/*!
@abstract Open Graph Action to be shared.
@return The action
/**
Open Graph Action to be shared.
- Returns: The action
*/
@property (nonatomic, copy) FBSDKShareOpenGraphAction *action;
/*!
@abstract Property name that points to the primary Open Graph Object in the action.
@discussion The value that this action points to will be use for rendering the preview for the share.
@return The property name for the Open Graph Object in the action
/**
Property name that points to the primary Open Graph Object in the action.
The value that this action points to will be use for rendering the preview for the share.
- Returns: The property name for the Open Graph Object in the action
*/
@property (nonatomic, copy) NSString *previewPropertyName;
/*!
@abstract Compares the receiver to another Open Graph content.
@param content The other content
@return YES if the receiver's values are equal to the other content's values; otherwise NO
/**
Compares the receiver to another Open Graph content.
- Parameter content: The other content
- Returns: YES if the receiver's values are equal to the other content's values; otherwise NO
*/
- (BOOL)isEqualToShareOpenGraphContent:(FBSDKShareOpenGraphContent *)content;
@@ -20,11 +20,12 @@
#import <FBSDKCoreKit/FBSDKCopying.h>
#import "FBSDKShareOpenGraphValueContainer.h"
#import <FBSDKShareKit/FBSDKShareOpenGraphValueContainer.h>
/*!
@abstract An Open Graph Object for sharing.
@discussion The property keys MUST have namespaces specified on them, such as `og:image`,
/**
An Open Graph Object for sharing.
The property keys MUST have namespaces specified on them, such as `og:image`,
and `og:type` is required.
See https://developers.facebook.com/docs/sharing/opengraph/object-properties for other properties.
@@ -42,16 +43,16 @@
*/
@interface FBSDKShareOpenGraphObject : FBSDKShareOpenGraphValueContainer <FBSDKCopying, NSSecureCoding>
/*!
@abstract Convenience method to build a new action and set the object for the specified key.
@param properties Properties for the Open Graph object, which will be parsed into the proper models
/**
Convenience method to build a new action and set the object for the specified key.
- Parameter properties: Properties for the Open Graph object, which will be parsed into the proper models
*/
+ (instancetype)objectWithProperties:(NSDictionary *)properties;
/*!
@abstract Compares the receiver to another Open Graph Object.
@param object The other object
@return YES if the receiver's values are equal to the other object's values; otherwise NO
/**
Compares the receiver to another Open Graph Object.
- Parameter object: The other object
- Returns: YES if the receiver's values are equal to the other object's values; otherwise NO
*/
- (BOOL)isEqualToShareOpenGraphObject:(FBSDKShareOpenGraphObject *)object;
@@ -21,139 +21,141 @@
@class FBSDKShareOpenGraphObject;
@class FBSDKSharePhoto;
/*!
@abstract Protocol defining operations on open graph actions and objects.
@discussion The property keys MUST have namespaces specified on them, such as `og:image`.
/**
Protocol defining operations on open graph actions and objects.
The property keys MUST have namespaces specified on them, such as `og:image`.
*/
@protocol FBSDKShareOpenGraphValueContaining <NSObject, NSSecureCoding>
/*!
@abstract Gets an NSArray out of the receiver.
@param key The key for the value
@return The NSArray value or nil
/**
Gets an NSArray out of the receiver.
- Parameter key: The key for the value
- Returns: The NSArray value or nil
*/
- (NSArray *)arrayForKey:(NSString *)key;
/*!
@abstract Applies a given block object to the entries of the receiver.
@param block A block object to operate on entries in the receiver
/**
Applies a given block object to the entries of the receiver.
- Parameter block: A block object to operate on entries in the receiver
*/
- (void)enumerateKeysAndObjectsUsingBlock:(void (^)(NSString *key, id object, BOOL *stop))block;
/*!
@abstract Returns an enumerator object that lets you access each key in the receiver.
@return An enumerator object that lets you access each key in the receiver
/**
Returns an enumerator object that lets you access each key in the receiver.
- Returns: An enumerator object that lets you access each key in the receiver
*/
- (NSEnumerator *)keyEnumerator;
/*!
@abstract Gets an NSNumber out of the receiver.
@param key The key for the value
@return The NSNumber value or nil
/**
Gets an NSNumber out of the receiver.
- Parameter key: The key for the value
- Returns: The NSNumber value or nil
*/
- (NSNumber *)numberForKey:(NSString *)key;
/*!
@abstract Returns an enumerator object that lets you access each value in the receiver.
@return An enumerator object that lets you access each value in the receiver
/**
Returns an enumerator object that lets you access each value in the receiver.
- Returns: An enumerator object that lets you access each value in the receiver
*/
- (NSEnumerator *)objectEnumerator;
/*!
@abstract Gets an FBSDKShareOpenGraphObject out of the receiver.
@param key The key for the value
@return The FBSDKShareOpenGraphObject value or nil
/**
Gets an FBSDKShareOpenGraphObject out of the receiver.
- Parameter key: The key for the value
- Returns: The FBSDKShareOpenGraphObject value or nil
*/
- (FBSDKShareOpenGraphObject *)objectForKey:(NSString *)key;
/*!
@abstract Enables subscript access to the values in the receiver.
@param key The key for the value
@return The value
/**
Enables subscript access to the values in the receiver.
- Parameter key: The key for the value
- Returns: The value
*/
- (id)objectForKeyedSubscript:(NSString *)key;
/*!
@abstract Parses properties out of a dictionary into the receiver.
@param properties The properties to parse.
/**
Parses properties out of a dictionary into the receiver.
- Parameter properties: The properties to parse.
*/
- (void)parseProperties:(NSDictionary *)properties;
/*!
@abstract Gets an FBSDKSharePhoto out of the receiver.
@param key The key for the value
@return The FBSDKSharePhoto value or nil
/**
Gets an FBSDKSharePhoto out of the receiver.
- Parameter key: The key for the value
- Returns: The FBSDKSharePhoto value or nil
*/
- (FBSDKSharePhoto *)photoForKey:(NSString *)key;
/*!
@abstract Removes a value from the receiver for the specified key.
@param key The key for the value
/**
Removes a value from the receiver for the specified key.
- Parameter key: The key for the value
*/
- (void)removeObjectForKey:(NSString *)key;
/*!
@abstract Sets an NSArray on the receiver.
@discussion This method will throw if the array contains any values that is not an NSNumber, NSString, NSURL,
/**
Sets an NSArray on the receiver.
This method will throw if the array contains any values that is not an NSNumber, NSString, NSURL,
FBSDKSharePhoto or FBSDKShareOpenGraphObject.
@param array The NSArray value
@param key The key for the value
- Parameter array: The NSArray value
- Parameter key: The key for the value
*/
- (void)setArray:(NSArray *)array forKey:(NSString *)key;
/*!
@abstract Sets an NSNumber on the receiver.
@param number The NSNumber value
@param key The key for the value
/**
Sets an NSNumber on the receiver.
- Parameter number: The NSNumber value
- Parameter key: The key for the value
*/
- (void)setNumber:(NSNumber *)number forKey:(NSString *)key;
/*!
@abstract Sets an FBSDKShareOpenGraphObject on the receiver.
@param object The FBSDKShareOpenGraphObject value
@param key The key for the value
/**
Sets an FBSDKShareOpenGraphObject on the receiver.
- Parameter object: The FBSDKShareOpenGraphObject value
- Parameter key: The key for the value
*/
- (void)setObject:(FBSDKShareOpenGraphObject *)object forKey:(NSString *)key;
/*!
@abstract Sets an FBSDKSharePhoto on the receiver.
@param photo The FBSDKSharePhoto value
@param key The key for the value
/**
Sets an FBSDKSharePhoto on the receiver.
- Parameter photo: The FBSDKSharePhoto value
- Parameter key: The key for the value
*/
- (void)setPhoto:(FBSDKSharePhoto *)photo forKey:(NSString *)key;
/*!
@abstract Sets an NSString on the receiver.
@param string The NSString value
@param key The key for the value
/**
Sets an NSString on the receiver.
- Parameter string: The NSString value
- Parameter key: The key for the value
*/
- (void)setString:(NSString *)string forKey:(NSString *)key;
/*!
@abstract Sets an NSURL on the receiver.
@param URL The NSURL value
@param key The key for the value
/**
Sets an NSURL on the receiver.
- Parameter URL: The NSURL value
- Parameter key: The key for the value
*/
- (void)setURL:(NSURL *)URL forKey:(NSString *)key;
/*!
@abstract Gets an NSString out of the receiver.
@param key The key for the value
@return The NSString value or nil
/**
Gets an NSString out of the receiver.
- Parameter key: The key for the value
- Returns: The NSString value or nil
*/
- (NSString *)stringForKey:(NSString *)key;
/*!
@abstract Gets an NSURL out of the receiver.
@param key The key for the value
@return The NSURL value or nil
/**
Gets an NSURL out of the receiver.
- Parameter key: The key for the value
- Returns: The NSURL value or nil
*/
- (NSURL *)URLForKey:(NSString *)key;
@end
/*!
@abstract A base class to container Open Graph values.
/**
A base class to container Open Graph values.
*/
@interface FBSDKShareOpenGraphValueContainer : NSObject <FBSDKShareOpenGraphValueContaining>
@@ -20,59 +20,60 @@
#import <FBSDKCoreKit/FBSDKCopying.h>
/*!
@abstract A photo for sharing.
/**
A photo for sharing.
*/
@interface FBSDKSharePhoto : NSObject <FBSDKCopying, NSSecureCoding>
/*!
@abstract Convenience method to build a new photo object with an image.
@param image If the photo is resident in memory, this method supplies the data
@param userGenerated Specifies whether the photo represented by the receiver was generated by the user or by the
/**
Convenience method to build a new photo object with an image.
- Parameter image: If the photo is resident in memory, this method supplies the data
- Parameter userGenerated: Specifies whether the photo represented by the receiver was generated by the user or by the
application
*/
+ (instancetype)photoWithImage:(UIImage *)image userGenerated:(BOOL)userGenerated;
/*!
@abstract Convenience method to build a new photo object with an imageURL.
@param imageURL The URL to the photo
@param userGenerated Specifies whether the photo represented by the receiver was generated by the user or by the
/**
Convenience method to build a new photo object with an imageURL.
- Parameter imageURL: The URL to the photo
- Parameter userGenerated: Specifies whether the photo represented by the receiver was generated by the user or by the
application
@discussion This method should only be used when adding photo content to open graph stories.
This method should only be used when adding photo content to open graph stories.
For example, if you're trying to share a photo from the web by itself, download the image and use
`photoWithImage:userGenerated:` instead.
*/
+ (instancetype)photoWithImageURL:(NSURL *)imageURL userGenerated:(BOOL)userGenerated;
/*!
@abstract If the photo is resident in memory, this method supplies the data.
@return UIImage representation of the photo
/**
If the photo is resident in memory, this method supplies the data.
- Returns: UIImage representation of the photo
*/
@property (nonatomic, strong) UIImage *image;
/*!
@abstract The URL to the photo.
@return URL that points to a network location or the location of the photo on disk
/**
The URL to the photo.
- Returns: URL that points to a network location or the location of the photo on disk
*/
@property (nonatomic, copy) NSURL *imageURL;
/*!
@abstract Specifies whether the photo represented by the receiver was generated by the user or by the application.
@return YES if the photo is user-generated, otherwise NO
/**
Specifies whether the photo represented by the receiver was generated by the user or by the application.
- Returns: YES if the photo is user-generated, otherwise NO
*/
@property (nonatomic, assign, getter=isUserGenerated) BOOL userGenerated;
/*!
@abstract Compares the receiver to another photo.
@param photo The other photo
@return YES if the receiver's values are equal to the other photo's values; otherwise NO
/**
Compares the receiver to another photo.
- Parameter photo: The other photo
- Returns: YES if the receiver's values are equal to the other photo's values; otherwise NO
*/
- (BOOL)isEqualToSharePhoto:(FBSDKSharePhoto *)photo;
/*!
@abstract The user generated caption for the photo. Note that the 'caption' must come from
/**
The user generated caption for the photo. Note that the 'caption' must come from
* the user, as pre-filled content is forbidden by the Platform Policies (2.3).
@return the Photo's caption if exists else returns null.
- Returns: the Photo's caption if exists else returns null.
*/
@property (nonatomic, copy) NSString *caption;
@@ -18,23 +18,23 @@
#import <Foundation/Foundation.h>
#import "FBSDKSharingContent.h"
#import <FBSDKShareKit/FBSDKSharingContent.h>
/*!
@abstract A model for photo content to be shared.
/**
A model for photo content to be shared.
*/
@interface FBSDKSharePhotoContent : NSObject <FBSDKSharingContent>
/*!
@abstract Photos to be shared.
@return Array of the photos (FBSDKSharePhoto)
/**
Photos to be shared.
- Returns: Array of the photos (FBSDKSharePhoto)
*/
@property (nonatomic, copy) NSArray *photos;
/*!
@abstract Compares the receiver to another photo content.
@param content The other content
@return YES if the receiver's values are equal to the other content's values; otherwise NO
/**
Compares the receiver to another photo content.
- Parameter content: The other content
- Returns: YES if the receiver's values are equal to the other content's values; otherwise NO
*/
- (BOOL)isEqualToSharePhotoContent:(FBSDKSharePhotoContent *)content;
@@ -22,40 +22,40 @@
@class FBSDKSharePhoto;
/*!
@abstract A video for sharing.
/**
A video for sharing.
*/
@interface FBSDKShareVideo : NSObject <FBSDKCopying, NSSecureCoding>
/*!
@abstract Convenience method to build a new video object with a videoURL.
@param videoURL The URL to the video
/**
Convenience method to build a new video object with a videoURL.
- Parameter videoURL: The URL to the video
*/
+ (instancetype)videoWithVideoURL:(NSURL *)videoURL;
/*!
@abstract Convenience method to build a new video object with a videoURL and a previewPhoto
@param videoURL The URL to the video
@param previewPhoto The photo that represents the video
/**
Convenience method to build a new video object with a videoURL and a previewPhoto
- Parameter videoURL: The URL to the video
- Parameter previewPhoto: The photo that represents the video
*/
+ (instancetype)videoWithVideoURL:(NSURL *)videoURL previewPhoto:(FBSDKSharePhoto *)previewPhoto;
/*!
@abstract The file URL to the video.
@return URL that points to the location of the video on disk
/**
The file URL to the video.
- Returns: URL that points to the location of the video on disk
*/
@property (nonatomic, copy) NSURL *videoURL;
/*!
@abstract The photo that represents the video.
@return The photo
/**
The photo that represents the video.
- Returns: The photo
*/
@property (nonatomic, copy) FBSDKSharePhoto *previewPhoto;
/*!
@abstract Compares the receiver to another video.
@param video The other video
@return YES if the receiver's values are equal to the other video's values; otherwise NO
/**
Compares the receiver to another video.
- Parameter video: The other video
- Returns: YES if the receiver's values are equal to the other video's values; otherwise NO
*/
- (BOOL)isEqualToShareVideo:(FBSDKShareVideo *)video;
@@ -18,31 +18,31 @@
#import <Foundation/Foundation.h>
#import "FBSDKSharePhoto.h"
#import "FBSDKShareVideo.h"
#import "FBSDKSharingContent.h"
#import <FBSDKShareKit/FBSDKSharePhoto.h>
#import <FBSDKShareKit/FBSDKShareVideo.h>
#import <FBSDKShareKit/FBSDKSharingContent.h>
/*!
@abstract A model for video content to be shared.
/**
A model for video content to be shared.
*/
@interface FBSDKShareVideoContent : NSObject <FBSDKSharingContent>
/*!
@abstract The photo that represents the video.
@return The photo
/**
The photo that represents the video.
- Returns: The photo
*/
@property (nonatomic, copy) FBSDKSharePhoto *previewPhoto;
/*!
@abstract The video to be shared.
@return The video
/**
The video to be shared.
- Returns: The video
*/
@property (nonatomic, copy) FBSDKShareVideo *video;
/*!
@abstract Compares the receiver to another video content.
@param content The other content
@return YES if the receiver's values are equal to the other content's values; otherwise NO
/**
Compares the receiver to another video content.
- Parameter content: The other content
- Returns: YES if the receiver's values are equal to the other content's values; otherwise NO
*/
- (BOOL)isEqualToShareVideoContent:(FBSDKShareVideoContent *)content;
@@ -18,92 +18,99 @@
#import <Foundation/Foundation.h>
#import "FBSDKSharingContent.h"
#import <FBSDKShareKit/FBSDKSharingContent.h>
@protocol FBSDKSharingDelegate;
/*!
@abstract The common interface for components that initiate sharing.
@see FBSDKShareDialog
@see FBSDKMessageDialog
@see FBSDKShareAPI
/**
The common interface for components that initiate sharing.
- See:FBSDKShareDialog
- See:FBSDKMessageDialog
- See:FBSDKShareAPI
*/
@protocol FBSDKSharing <NSObject>
/*!
@abstract The receiver's delegate or nil if it doesn't have a delegate.
/**
The receiver's delegate or nil if it doesn't have a delegate.
*/
@property (nonatomic, weak) id<FBSDKSharingDelegate> delegate;
/*!
@abstract The content to be shared.
/**
The content to be shared.
*/
@property (nonatomic, copy) id<FBSDKSharingContent> shareContent;
/*!
@abstract A Boolean value that indicates whether the receiver should fail if it finds an error with the share content.
@discussion If NO, the sharer will still be displayed without the data that was mis-configured. For example, an
/**
A Boolean value that indicates whether the receiver should fail if it finds an error with the share content.
If NO, the sharer will still be displayed without the data that was mis-configured. For example, an
invalid placeID specified on the shareContent would produce a data error.
*/
@property (nonatomic, assign) BOOL shouldFailOnDataError;
/*!
@abstract Validates the content on the receiver.
@param errorRef If an error occurs, upon return contains an NSError object that describes the problem.
@return YES if the content is valid, otherwise NO.
/**
Validates the content on the receiver.
- Parameter errorRef: If an error occurs, upon return contains an NSError object that describes the problem.
- Returns: YES if the content is valid, otherwise NO.
*/
- (BOOL)validateWithError:(NSError **)errorRef;
@end
/*!
@abstract The common interface for dialogs that initiate sharing.
/**
The common interface for dialogs that initiate sharing.
*/
@protocol FBSDKSharingDialog <FBSDKSharing>
/*!
@abstract A Boolean value that indicates whether the receiver can initiate a share.
@discussion May return NO if the appropriate Facebook app is not installed and is required or an access token is
/**
A Boolean value that indicates whether the receiver can initiate a share.
May return NO if the appropriate Facebook app is not installed and is required or an access token is
required but not available. This method does not validate the content on the receiver, so this can be checked before
building up the content.
@see [FBSDKSharing validateWithError:]
@result YES if the receiver can share, otherwise NO.
- See:[FBSDKSharing validateWithError:]
- Returns: YES if the receiver can share, otherwise NO.
*/
- (BOOL)canShow;
/*!
@abstract Shows the dialog.
@result YES if the receiver was able to begin sharing, otherwise NO.
/**
Shows the dialog.
- Returns: YES if the receiver was able to begin sharing, otherwise NO.
*/
- (BOOL)show;
@end
/*!
@abstract A delegate for FBSDKSharing.
@discussion The delegate is notified with the results of the sharer as long as the application has permissions to
/**
A delegate for FBSDKSharing.
The delegate is notified with the results of the sharer as long as the application has permissions to
receive the information. For example, if the person is not signed into the containing app, the sharer may not be able
to distinguish between completion of a share and cancellation.
*/
@protocol FBSDKSharingDelegate <NSObject>
/*!
@abstract Sent to the delegate when the share completes without error or cancellation.
@param sharer The FBSDKSharing that completed.
@param results The results from the sharer. This may be nil or empty.
/**
Sent to the delegate when the share completes without error or cancellation.
- Parameter sharer: The FBSDKSharing that completed.
- Parameter results: The results from the sharer. This may be nil or empty.
*/
- (void)sharer:(id<FBSDKSharing>)sharer didCompleteWithResults:(NSDictionary *)results;
/*!
@abstract Sent to the delegate when the sharer encounters an error.
@param sharer The FBSDKSharing that completed.
@param error The error.
/**
Sent to the delegate when the sharer encounters an error.
- Parameter sharer: The FBSDKSharing that completed.
- Parameter error: The error.
*/
- (void)sharer:(id<FBSDKSharing>)sharer didFailWithError:(NSError *)error;
/*!
@abstract Sent to the delegate when the sharer is cancelled.
@param sharer The FBSDKSharing that completed.
/**
Sent to the delegate when the sharer is cancelled.
- Parameter sharer: The FBSDKSharing that completed.
*/
- (void)sharerDidCancel:(id<FBSDKSharing>)sharer;
@@ -18,17 +18,19 @@
#import <Foundation/Foundation.h>
#import "FBSDKSharingContent.h"
#import <FBSDKShareKit/FBSDKSharingContent.h>
/*!
@abstract The common interface for sharing buttons.
@see FBSDKSendButton
@see FBSDKShareButton
/**
The common interface for sharing buttons.
- See:FBSDKSendButton
- See:FBSDKShareButton
*/
@protocol FBSDKSharingButton <NSObject>
/*!
@abstract The content to be shared.
/**
The content to be shared.
*/
@property (nonatomic, copy) id<FBSDKSharingContent> shareContent;
@@ -22,42 +22,43 @@
@class FBSDKHashtag;
/*!
@abstract A base interface for content to be shared.
/**
A base interface for content to be shared.
*/
@protocol FBSDKSharingContent <FBSDKCopying, NSSecureCoding>
/*!
@abstract URL for the content being shared.
@discussion This URL will be checked for all link meta tags for linking in platform specific ways. See documentation
/**
URL for the content being shared.
This URL will be checked for all link meta tags for linking in platform specific ways. See documentation
for App Links (https://developers.facebook.com/docs/applinks/)
@return URL representation of the content link
- Returns: URL representation of the content link
*/
@property (nonatomic, copy) NSURL *contentURL;
/*!
@abstract Hashtag for the content being shared.
@return The hashtag for the content being shared.
/**
Hashtag for the content being shared.
- Returns: The hashtag for the content being shared.
*/
@property (nonatomic, copy) FBSDKHashtag *hashtag;
/*!
@abstract List of IDs for taggable people to tag with this content.
@description See documentation for Taggable Friends
/**
List of IDs for taggable people to tag with this content.
See documentation for Taggable Friends
(https://developers.facebook.com/docs/graph-api/reference/user/taggable_friends)
@return Array of IDs for people to tag (NSString)
- Returns: Array of IDs for people to tag (NSString)
*/
@property (nonatomic, copy) NSArray *peopleIDs;
/*!
@abstract The ID for a place to tag with this content.
@return The ID for the place to tag
/**
The ID for a place to tag with this content.
- Returns: The ID for the place to tag
*/
@property (nonatomic, copy) NSString *placeID;
/*!
@abstract A value to be added to the referrer URL when a person follows a link from this shared content on feed.
@return The ref for the content.
/**
A value to be added to the referrer URL when a person follows a link from this shared content on feed.
- Returns: The ref for the content.
*/
@property (nonatomic, copy) NSString *ref;
@@ -21,7 +21,7 @@
#import <FBSDKCoreKit/FBSDKMacros.h>
#import "FBSDKLikeObjectType.h"
#import <FBSDKShareKit/FBSDKLikeObjectType.h>
FBSDK_EXTERN NSString *const FBSDKLikeActionControllerDidDisableNotification;
FBSDK_EXTERN NSString *const FBSDKLikeActionControllerDidResetNotification;
@@ -18,20 +18,20 @@
#import <UIKit/UIKit.h>
/*!
@typedef NS_ENUM(NSUInteger, FBSDKLikeBoxCaretPosition)
/**
NS_ENUM(NSUInteger, FBSDKLikeBoxCaretPosition)
@abstract Specifies the position of the caret relative to the box.
Specifies the position of the caret relative to the box.
*/
typedef NS_ENUM(NSUInteger, FBSDKLikeBoxCaretPosition)
{
/*! The caret is on the top of the box. */
/** The caret is on the top of the box. */
FBSDKLikeBoxCaretPositionTop,
/*! The caret is on the left of the box. */
/** The caret is on the left of the box. */
FBSDKLikeBoxCaretPositionLeft,
/*! The caret is on the bottom of the box. */
/** The caret is on the bottom of the box. */
FBSDKLikeBoxCaretPositionBottom,
/*! The caret is on the right of the box. */
/** The caret is on the right of the box. */
FBSDKLikeBoxCaretPositionRight,
};
@@ -19,7 +19,7 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "FBSDKLikeObjectType.h"
#import <FBSDKShareKit/FBSDKLikeObjectType.h>
@protocol FBSDKLikeDialogDelegate;
@@ -25,6 +25,7 @@
#define FBSDK_SHARE_RESULT_COMPLETION_GESTURE_VALUE_CANCEL @"cancel"
#define FBSDK_SHARE_RESULT_COMPLETION_GESTURE_VALUE_POST @"post"
#define FBSDK_SHARE_RESULT_DID_COMPLETE_KEY @"didComplete"
#define FBSDK_SHARE_RESULT_PHOTO_IDS_KEY @"photo_ids"
#define FBSDK_SHARE_RESULT_POST_ID_KEY @"postId"
#define FBSDK_SHARE_VIDEO_END_OFFSET @"end_offset"
#define FBSDK_SHARE_VIDEO_FILE_CHUNK @"video_file_chunk"
@@ -18,7 +18,7 @@
#import <UIKit/UIKit.h>
#import "FBSDKShareKit.h"
#import <FBSDKShareKit/FBSDKShareKit.h>
#import "FBSDKShareDefines.h"
#import "FBSDKShareError.h"
@@ -18,7 +18,7 @@
#import <Foundation/Foundation.h>
#import "FBSDKShareOpenGraphValueContainer.h"
#import <FBSDKShareKit/FBSDKShareOpenGraphValueContainer.h>
@interface FBSDKShareOpenGraphValueContainer ()
@@ -18,16 +18,16 @@
#import <Foundation/Foundation.h>
#import "FBSDKShareLinkContent.h"
#import "FBSDKShareMediaContent.h"
#import "FBSDKShareOpenGraphContent.h"
#import "FBSDKSharePhotoContent.h"
#import "FBSDKShareVideoContent.h"
#import "FBSDKSharingContent.h"
#import <FBSDKShareKit/FBSDKShareLinkContent.h>
#import <FBSDKShareKit/FBSDKShareMediaContent.h>
#import <FBSDKShareKit/FBSDKShareOpenGraphContent.h>
#import <FBSDKShareKit/FBSDKSharePhotoContent.h>
#import <FBSDKShareKit/FBSDKShareVideoContent.h>
#import <FBSDKShareKit/FBSDKSharingContent.h>
#if !TARGET_OS_TV
#import "FBSDKAppInviteContent.h"
#import "FBSDKGameRequestContent.h"
#import <FBSDKShareKit/FBSDKAppInviteContent.h>
#import <FBSDKShareKit/FBSDKGameRequestContent.h>
#endif
@interface FBSDKShareUtility : NSObject
@@ -42,9 +42,14 @@
methodName:(NSString *__autoreleasing *)methodNameRef
parameters:(NSDictionary *__autoreleasing *)parametersRef
error:(NSError *__autoreleasing *)errorRef;
+ (void)buildAsyncWebPhotoContent:(FBSDKSharePhotoContent *)content
completionHandler:(void(^)(BOOL, NSString *, NSDictionary *))completion;
+ (NSDictionary *)convertOpenGraphValues:(NSDictionary *)dictionary;
+ (NSDictionary *)feedShareDictionaryForContent:(id<FBSDKSharingContent>)content;
+ (NSString *)hashtagStringFromHashtag:(FBSDKHashtag *)hashtag;
+ (UIImage *)imageWithCircleColor:(UIColor *)color
canvasSize:(CGSize)canvasSize
circleSize:(CGSize)circleSize;
+ (NSDictionary *)parametersForShareContent:(id<FBSDKSharingContent>)shareContent
shouldFailOnDataError:(BOOL)shouldFailOnDataError;
+ (void)testShareContent:(id<FBSDKSharingContent>)shareContent
@@ -165,6 +165,38 @@
return YES;
}
+ (void)buildAsyncWebPhotoContent:(FBSDKSharePhotoContent *)content
completionHandler:(void(^)(BOOL, NSString *, NSDictionary *))completion
{
void(^stageImageCompletion)(NSArray<NSString *> *) = ^(NSArray<NSString *> *stagedURIs) {
NSString *methodName = @"share";
NSMutableDictionary *parameters = [[FBSDKShareUtility parametersForShareContent:content
shouldFailOnDataError:NO] mutableCopy];
[parameters removeObjectForKey:@"photos"];
NSString *stagedURIJSONString = [FBSDKInternalUtility JSONStringForObject:stagedURIs
error:nil
invalidObjectHandler:NULL];
[FBSDKInternalUtility dictionary:parameters
setObject:stagedURIJSONString
forKey:@"media"];
NSString *hashtagString = [self hashtagStringFromHashtag:content.hashtag];
if (hashtagString != nil) {
[FBSDKInternalUtility dictionary:parameters
setObject:hashtagString
forKey:@"hashtag"];
}
if (completion != NULL) {
completion(YES, methodName, [parameters copy]);
}
};
[self _stageImagesForPhotoContent:(FBSDKSharePhotoContent *)content
withCompletionHandler:stageImageCompletion];
}
+ (id)convertOpenGraphValue:(id)value
{
if ([self _isOpenGraphValue:value]) {
@@ -213,6 +245,7 @@
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.contentDescription forKey:@"description"];
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.contentURL forKey:@"link"];
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.quote forKey:@"quote"];
[FBSDKInternalUtility dictionary:parameters setObject:[self hashtagStringFromHashtag:linkContent.hashtag] forKey:@"hashtag"];
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.contentTitle forKey:@"name"];
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.imageURL forKey:@"picture"];
[FBSDKInternalUtility dictionary:parameters setObject:linkContent.ref forKey:@"ref"];
@@ -234,6 +267,23 @@
}
}
+ (UIImage *)imageWithCircleColor:(UIColor *)color
canvasSize:(CGSize)canvasSize
circleSize:(CGSize)circleSize
{
CGRect circleFrame = CGRectMake((canvasSize.width - circleSize.width) / 2.0,
(canvasSize.height - circleSize.height) / 2.0,
circleSize.width,
circleSize.height);
UIGraphicsBeginImageContextWithOptions(canvasSize, NO, 0);
CGContextRef context = UIGraphicsGetCurrentContext();
[color setFill];
CGContextFillEllipseInRect(context, circleFrame);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
+ (NSDictionary *)parametersForShareContent:(id<FBSDKSharingContent>)shareContent
shouldFailOnDataError:(BOOL)shouldFailOnDataError
{
@@ -727,6 +777,37 @@ forShareOpenGraphContent:(FBSDKShareOpenGraphContent *)openGraphContent
[value isKindOfClass:[FBSDKShareOpenGraphObject class]]);
}
+ (void)_stageImagesForPhotoContent:(FBSDKSharePhotoContent *)content
withCompletionHandler:(void(^)(NSArray<NSString *> *))completion
{
__block NSMutableArray<NSString *> *stagedURIs = [NSMutableArray array];
dispatch_group_t group = dispatch_group_create();
for (FBSDKSharePhoto *photo in content.photos) {
if (photo.image != nil) {
dispatch_group_enter(group);
NSDictionary *stagingParameters = @{
@"file" : photo.image,
};
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"me/staging_resources"
parameters:stagingParameters
HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
NSString *photoStagedURI = result[@"uri"];
if (photoStagedURI != nil) {
[stagedURIs addObject:photoStagedURI];
dispatch_group_leave(group);
}
}];
}
}
dispatch_group_notify(group, dispatch_get_main_queue(), ^{
if (completion != NULL) {
completion([stagedURIs copy]);
}
});
}
+ (void)_testObject:(id)object containsMedia:(BOOL *)containsMediaRef containsPhotos:(BOOL *)containsPhotosRef containsVideos:(BOOL *)containsVideosRef
{
BOOL containsMedia = NO;
@@ -837,7 +918,7 @@ forShareOpenGraphContent:(FBSDKShareOpenGraphContent *)openGraphContent
}
return NO;
}
// ensure that the file exists. per the latest spec for NSFileManager, we should not be checking for file existance,
// ensure that the file exists. per the latest spec for NSFileManager, we should not be checking for file existence,
// so they have removed that option for URLs and discourage it for paths, so we just construct a mapped NSData.
NSError *fileError;
if (![[NSData alloc] initWithContentsOfURL:URL
@@ -20,82 +20,84 @@
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import "FBSDKShareVideo.h"
#import "FBSDKSharing.h"
#import <FBSDKShareKit/FBSDKShareVideo.h>
#import <FBSDKShareKit/FBSDKSharing.h>
@protocol FBSDKVideoUploaderDelegate;
/*!
@abstract A utility class for uploading through the chunk upload graph API. Using this class requires an access token in
/**
A utility class for uploading through the chunk upload graph API. Using this class requires an access token in
`[FBSDKAccessToken currentAccessToken]` that has been granted the "publish_actions" permission.
@discussion see https://developers.facebook.com/docs/graph-api/video-uploads
see https://developers.facebook.com/docs/graph-api/video-uploads
*/
@interface FBSDKVideoUploader : NSObject
/*!
@abstract Initialize videoUploader
@param videoName The file name of the video to be uploaded
@param videoSize The size of the video to be uploaded
@param parameters Optional parameters for video uploads. See Graph API documentation for the full list of parameters https://developers.facebook.com/docs/graph-api/reference/video
@param delegate Receiver's delegate
/**
Initialize videoUploader
- Parameter videoName: The file name of the video to be uploaded
- Parameter videoSize: The size of the video to be uploaded
- Parameter parameters: Optional parameters for video uploads. See Graph API documentation for the full list of parameters https://developers.facebook.com/docs/graph-api/reference/video
- Parameter delegate: Receiver's delegate
*/
- (instancetype)initWithVideoName:(NSString *)videoName videoSize:(NSUInteger)videoSize parameters:(NSDictionary *)parameters delegate:(id<FBSDKVideoUploaderDelegate>)delegate
NS_DESIGNATED_INITIALIZER;
/*!
@abstract The video to be uploaded.
/**
The video to be uploaded.
*/
@property (readonly, copy, nonatomic) FBSDKShareVideo *video;
/*!
@abstract Optional parameters for video uploads. See Graph API documentation for the full list of parameters https://developers.facebook.com/docs/graph-api/reference/video
/**
Optional parameters for video uploads. See Graph API documentation for the full list of parameters https://developers.facebook.com/docs/graph-api/reference/video
*/
@property (copy, nonatomic) NSDictionary *parameters;
/*!
@abstract The graph node to which video should be uploaded
/**
The graph node to which video should be uploaded
*/
@property (nonatomic, copy) NSString *graphNode;
/*!
@abstract Receiver's delegate
/**
Receiver's delegate
*/
@property (weak, nonatomic) id<FBSDKVideoUploaderDelegate> delegate;
/*!
@abstract Start upload process
/**
Start upload process
*/
//TODO #6229672 add cancel and/or pause
- (void)start;
@end
/*!
@abstract A delegate for `FBSDKVideoUploader`.
@discussion The delegate passes video chunk to `FBSDKVideoUploader` object in `NSData` format and is notified with the results of the uploader.
/**
A delegate for `FBSDKVideoUploader`.
The delegate passes video chunk to `FBSDKVideoUploader` object in `NSData` format and is notified with the results of the uploader.
*/
@protocol FBSDKVideoUploaderDelegate <NSObject>
/*!
@abstract get chunk of the video to be uploaded in 'NSData' format
@param videoUploader The `FBSDKVideoUploader` object which is performing the upload process
@param startOffset The start offset of video chunk to be uploaded
@param endOffset The end offset of video chunk being to be uploaded
/**
get chunk of the video to be uploaded in 'NSData' format
- Parameter videoUploader: The `FBSDKVideoUploader` object which is performing the upload process
- Parameter startOffset: The start offset of video chunk to be uploaded
- Parameter endOffset: The end offset of video chunk being to be uploaded
*/
- (NSData *)videoChunkDataForVideoUploader:(FBSDKVideoUploader *)videoUploader startOffset:(NSUInteger) startOffset endOffset:(NSUInteger) endOffset;
/*!
@abstract Notify the delegate that upload process success.
@param videoUploader The `FBSDKVideoUploader` object which is performing the upload process
@param results The result from successful upload
/**
Notify the delegate that upload process success.
- Parameter videoUploader: The `FBSDKVideoUploader` object which is performing the upload process
- Parameter results: The result from successful upload
*/
- (void)videoUploader:(FBSDKVideoUploader *)videoUploader didCompleteWithResults:(NSDictionary *)results;
/*!
@abstract Notify the delegate that upload process fails.
@param videoUploader The `FBSDKVideoUploader` object which is performing the upload process
@param error The error object from unsuccessful upload
/**
Notify the delegate that upload process fails.
- Parameter videoUploader: The `FBSDKVideoUploader` object which is performing the upload process
- Parameter error: The error object from unsuccessful upload
*/
- (void)videoUploader:(FBSDKVideoUploader *)videoUploader didFailWithError:(NSError *)error;