FIRDynamicLinks

@interface FIRDynamicLinks : NSObject

A class that checks for pending Dynamic Links and parses URLs.

  • Shared instance of FIRDynamicLinks. Returns nil on iOS versions prior to 8. - returns: Shared instance of FIRDynamicLinks.

    Declaration

    Swift

    class func dynamicLinks() -> Self?

    Objective-C

    + (nullable instancetype)dynamicLinks;

    Return Value

    Shared instance of FIRDynamicLinks.

  • Determine whether FIRDynamicLinks should handle the given URL. This does not guarantee that |dynamicLinkFromCustomSchemeURL:| will return a non-nil value, but it means the client should not attempt to handle the URL. - parameter: url Custom scheme URL. - returns: Whether the URL can be handled by FIRDynamicLinks.

    Declaration

    Swift

    func shouldHandleDynamicLink(fromCustomSchemeURL url: URL) -> Bool

    Objective-C

    - (BOOL)shouldHandleDynamicLinkFromCustomSchemeURL:(nonnull NSURL *)url;

    Parameters

    url

    Custom scheme URL.

    Return Value

    Whether the URL can be handled by FIRDynamicLinks.

  • Get a Dynamic Link from a custom scheme URL. This method parses URLs with a custom scheme, for instance, comgoogleapp://google/link?deep_link_id=abc123. It is suggested to call it inside your |UIApplicationDelegate|’s |application:openURL:sourceApplication:annotation| and |application:openURL:options:| methods. - parameter: url Custom scheme URL. - returns: Dynamic Link object if the URL is valid and has link parameter, otherwise nil.

    Declaration

    Swift

    func dynamicLink(fromCustomSchemeURL url: URL) -> FIRDynamicLink?

    Objective-C

    - (nullable FIRDynamicLink *)dynamicLinkFromCustomSchemeURL:
        (nonnull NSURL *)url;

    Parameters

    url

    Custom scheme URL.

    Return Value

    Dynamic Link object if the URL is valid and has link parameter, otherwise nil.

  • Get a Dynamic Link from a universal link URL. This method parses universal link URLs, for instance, https://example.app.goo.gl?link=https://www.google.com&ibi=com.google.app&ius=comgoogleapp. It is suggested to call it inside your |UIApplicationDelegate|’s |application:continueUserActivity:restorationHandler:| method. - parameter: url Custom scheme URL. - returns: Dynamic Link object if the URL is valid and has link parameter, otherwise nil.

    Declaration

    Swift

    func dynamicLink(fromUniversalLinkURL url: URL) -> FIRDynamicLink?

    Objective-C

    - (nullable FIRDynamicLink *)dynamicLinkFromUniversalLinkURL:
        (nonnull NSURL *)url;

    Parameters

    url

    Custom scheme URL.

    Return Value

    Dynamic Link object if the URL is valid and has link parameter, otherwise nil.

  • Convenience method to handle a Universal Link whether it is long or short. A long link will call the handler immediately, but a short link may not. - parameter: url A Universal Link URL. - parameter: completion A block that handles the outcome of attempting to create a FIRDynamicLink. - returns: YES if FIRDynamicLinks is handling the link, otherwise, NO.

    Declaration

    Swift

    func handleUniversalLink(_ url: URL, completion: @escaping FIRDynamicLinkUniversalLinkHandler) -> Bool

    Objective-C

    - (BOOL)handleUniversalLink:(nonnull NSURL *)url
                     completion:
                         (nonnull FIRDynamicLinkUniversalLinkHandler)completion;

    Parameters

    url

    A Universal Link URL.

    completion

    A block that handles the outcome of attempting to create a FIRDynamicLink.

    Return Value

    YES if FIRDynamicLinks is handling the link, otherwise, NO.

  • Retrieves the details of the Dynamic Link that the shortened URL represents. - parameter: url A Short Dynamic Link. - parameter: completion Block to be run upon completion.

    Declaration

    Swift

    func resolveShortLink(_ url: URL, completion: @escaping FIRDynamicLinkResolverHandler)

    Objective-C

    - (void)resolveShortLink:(nonnull NSURL *)url
                  completion:(nonnull FIRDynamicLinkResolverHandler)completion;

    Parameters

    url

    A Short Dynamic Link.

    completion

    Block to be run upon completion.

  • Determines if a given URL matches the given short Dynamic Link format. - parameter: url A URL. - returns: YES if the URL is a short Dynamic Link, otherwise, NO.

    Declaration

    Swift

    func matchesShortLinkFormat(_ url: URL) -> Bool

    Objective-C

    - (BOOL)matchesShortLinkFormat:(nonnull NSURL *)url;

    Parameters

    url

    A URL.

    Return Value

    YES if the URL is a short Dynamic Link, otherwise, NO.