Skip to content

iOS: enableFacebookDeferredApplinks can never succeed in Capacitor apps — canImport(FacebookCore) is never true under CocoaPods #207

Description

@bariskodas

Report

Plugin Version

6.18.0

On what Platform are you having the issue?

ios

What did you do?

Called enableFacebookDeferredApplinks() before initSDK() in a Capacitor app that has the Facebook SDK installed and configured (FBSDKCoreKit 18.1.1, installed via CocoaPods).

What did you expect to happen?

Facebook deferred App Links attribution to be enabled.

What happened instead?

The call always rejects with Please install FBSDK First!, so Facebook deferred deep link attribution can never be enabled from a Capacitor app.

Please provide any other relevant information.

The native implementation gates the feature behind a compile-time check in ios/Plugin/AppsFlyerPlugin.swift:

#if canImport(FacebookCore)
        AppsFlyerLib.shared().enableFacebookDeferredApplinks(with: FBSDKAppLinkUtility.self)
        call.resolve(["res": "enabled"])
#else
        call.reject("Please install FBSDK First!")
#endif

FacebookCore as a module name only exists under Swift Package Manager (and the pre-v9 wrapper pods, removed after Facebook SDK v8). Capacitor apps install the Facebook SDK via CocoaPods, where the module is named FBSDKCoreKit — so the #else branch is always the one that gets compiled, and the call cannot succeed in any Capacitor app.

Suggested fix: also accept the CocoaPods module name, plus the matching conditional import:

#if canImport(FacebookCore) || canImport(FBSDKCoreKit)

Related: #39 reported this against 6.9.2; it was closed without a code change and the gate is unchanged in 6.18.0.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions