Skip to content

Sharing preview in shareSheet mode not working #2184

@devcros4

Description

@devcros4

Checklist before submitting a bug report

Xcode version

14.2

Facebook iOS SDK version

16

Dependency Manager

SPM

SDK Framework

Share

Goals

Share link via ShareDialog with preview of the link and with FB app installed.

Expected results

IMG_0008

Actual results

IMG_21B3000CC7E0-1

Steps to reproduce

  • use shareDialog
  • set shareDialog mode to .shareSheet

Code samples & details

override func prepare(withActivityItems activityItems: [Any]) {
		guard let url = activityItems.first(where: { $0 is URL }) as? URL else {
			self.shareContent = nil

			return
		}

		let shareContent = ShareLinkContent()

		shareContent.contentURL = url

		self.shareContent = shareContent
	}

	override func perform() {
		guard let shareContent = shareContent else {
			logger.error(ReplicaCategory.sharing, "Error while sharing to Facebook: no content")

			return
		}

        let shareDialog = ShareDialog(viewController: self.fromViewController, content: shareContent, delegate: self)

		shareDialog.mode = .shareSheet

        do {
            try shareDialog.validate()
        } catch {
            logger.info(ReplicaCategory.sharing, "FacebookShareActivity - \(error.localizedDescription)")

        }

		shareDialog.show()
	}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions