iOS SDK Version

FBSDKSharePhoto

@interfaceFBSDKSharePhoto:NSObject<NSSecureCoding,FBSDKCopying,FBSDKShareMedia,FBSDKSharingValidation>
A photo for sharing.
  • Convenience method to build a new photo object with an image.

    Declaration

    Objective-C
    +(nonnullinstancetype)photoWithImage:(nonnullUIImage*)imageuserGenerated:(BOOL)userGenerated;
    Swift
    convenienceinit(image:UIImage,userGenerated:Bool)

    Parameters

    image
    If the photo is resident in memory, this method supplies the data
    userGenerated
    Specifies whether the photo represented by the receiver was generated by the user or by the application
  • Convenience method to build a new photo object with an imageURL.
    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.

    Declaration

    Objective-C
    +(nonnullinstancetype)photoWithImageURL:(nonnullNSURL*)imageURLuserGenerated:(BOOL)userGenerated;
    Swift
    convenienceinit(imageURL:URL,userGenerated:Bool)

    Parameters

    imageURL
    The URL to the photo
    userGenerated
    Specifies whether the photo represented by the receiver was generated by the user or by the application
  • Convenience method to build a new photo object with a PHAsset.

    Declaration

    Objective-C
    +(nonnullinstancetype)photoWithPhotoAsset:(nonnullPHAsset*)photoAssetuserGenerated:(BOOL)userGenerated;
    Swift
    convenienceinit(photoAsset:PHAsset,userGenerated:Bool)
  • If the photo is resident in memory, this method supplies the data.

    Declaration

    Objective-C
    @property(nonatomic,strong,readwrite,nullable)UIImage*image;
    Swift
    varimage:UIImage?{getset}

    Return Value

    UIImage representation of the photo
  • The URL to the photo.

    Declaration

    Objective-C
    @property(nonatomic,copy,readwrite,nullable)NSURL*imageURL;
    Swift
    varimageURL:URL?{getset}

    Return Value

    URL that points to a network location or the location of the photo on disk
  • The representation of the photo in the Photos library.

    Declaration

    Objective-C
    @property(nonatomic,copy,readwrite,nullable)PHAsset*photoAsset;
    Swift
    @NSCopyingvarphotoAsset:PHAsset?{getset}

    Return Value

    PHAsset that represents the photo in the Photos library.
  • Specifies whether the photo represented by the receiver was generated by the user or by the application.

    Declaration

    Objective-C
    @property(nonatomic,assign,unsafe_unretained,readwrite,getter=isUserGenerated)BOOLuserGenerated;
    Swift
    varisUserGenerated:Bool{getset}

    Return Value

    YES if the photo is user-generated, otherwise NO
  • 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).

    Declaration

    Objective-C
    @property(nonatomic,copy,readwrite,nullable)NSString*caption;
    Swift
    varcaption:String?{getset}

    Return Value

    the Photo’s caption if exists else returns null.
  • Compares the receiver to another photo.

    Declaration

    Objective-C
    -(BOOL)isEqualToSharePhoto:(nonnullFBSDKSharePhoto*)photo;
    Swift
    funcisEqual(tophoto:SharePhoto)->Bool

    Parameters

    photo
    The other photo

    Return Value

    YES if the receiver’s values are equal to the other photo’s values; otherwise NO