Praxiteles
Praxiteles

Reputation: 6020

How remove a "use of undeclared identifier: FIRDynamicLink"?

We are following the dynamic instructions for Firebase here, which lists just one import needed "@import Firebase" - yet when we get to their line

FIRDynamicLink *dynamicLink = [[FIRDynamicLinks dynamicLinks] dynamicLinkFromCustomSchemeURL:url];

if (dynamicLink) { ...

...XCode gives an undeclared identifier for FIRDynamicLink. Unlike some of the other modules like "import FirebaseAnalytics" - there doesn't seem to be another library dedicated to Dynamic Links.

The pod content is: pod "Firebase/DynamicLinks"

What is the trick to get this to compile?

Upvotes: 4

Views: 3377

Answers (3)

Amber K
Amber K

Reputation: 698

It was working earlier. But due to some changes in podfile I was starting to get this irritating issue. Hence explicitly importing submodules satisfies compiler.

import FirebaseDynamicLinks
import FirebaseInstanceID

Upvotes: 3

Manuela Butnăraşu
Manuela Butnăraşu

Reputation: 1

I think they just confused between Objective-C and Swift. In swift they say to write this:

guard let dynamicLinks = DynamicLinks.dynamicLinks() else {
return false

}

but it has to be like this:

guard let dynamicLinks = FIRDynamicLinks.dynamicLinks() else {
return false

}

So I think for Objective-C you should use this:

BOOL handled = [[DynamicLinks dynamicLinks] handleUniversalLink:userActivity.webpageURL
                                                      completion:^(DynamicLink * _Nullable dynamicLink,
                                                                   NSError * _Nullable error) {
                                                        // ...
                                                      }];

Upvotes: 0

Praxiteles
Praxiteles

Reputation: 6020

We solved this by adding the following import line. It wasn't mentioned in Google's documentation so we are unsure if it is the correct thing to do - but it does enable the app to compile.

@import FirebaseDynamicLinks;

Was this a simple oversight in their example code or are we misunderstanding something?

Upvotes: 8

Related Questions