firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.67k stars 1.49k forks source link

FIRInstanceID identifier not found #5662

Closed rahul-inspired-iosdeveloper closed 4 years ago

rahul-inspired-iosdeveloper commented 4 years ago

Step 0: Are you in the right place?

[REQUIRED] Step 1: Describe your environment

[REQUIRED] Step 2: Describe the problem

I have a objective-c project, after updating firebase and other components the project is showing "FIRInstanceID" as unknown identifier.

Steps to reproduce:

After updating firebase pod repos in my objective-c project.

Relevant Code:

[[FIRInstanceID instanceID] instanceIDWithHandler:^(FIRInstanceIDResult _Nullable result, NSError _Nullable error) {}];

google-oss-bot commented 4 years ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

ryanwilson commented 4 years ago

Hi @rahul-inspired-iosdeveloper - are you using the InstanceID in your own project, or are you trying to get it to trigger for Firebase purposes?

In version 4.4.10 the Remote Config SDK now depends on the FirebaseInstallations SDK instead of InstanceID. https://github.com/firebase/firebase-ios-sdk/blob/master/FirebaseRemoteConfig/CHANGELOG.md#v4410

If you explicitly need InstanceID still you can include it in your Podfile, otherwise migrating to FirebaseInstallations (FIS) for your own calls is recommended. Recently InstanceID switched to using the FIS implementation under the hood so the values coming back should be identical if you're upgrading from a recent version of Firebase (and IID).

rahul-inspired-iosdeveloper commented 4 years ago

Hi @rahul-inspired-iosdeveloper - are you using the InstanceID in your own project, or are you trying to get it to trigger for Firebase purposes?

In version 4.4.10 the Remote Config SDK now depends on the FirebaseInstallations SDK instead of InstanceID. https://github.com/firebase/firebase-ios-sdk/blob/master/FirebaseRemoteConfig/CHANGELOG.md#v4410

If you explicitly need InstanceID still you can include it in your Podfile, otherwise migrating to FirebaseInstallations (FIS) for your own calls is recommended. Recently InstanceID switched to using the FIS implementation under the hood so the values coming back should be identical if you're upgrading from a recent version of Firebase (and IID).

I am using FIRInstanceID for my own debugging purpose, can I replace this with the library you mentioned?

ryanwilson commented 4 years ago

Yes, the respective call would be:

[[FIRInstallations installations] installationIDWithCompletion:]

Thanks! I'll close this for now but feel free to keep commenting as needed.

maksymmalyhin commented 4 years ago

I am using FIRInstanceID for my own debugging purpose, can I replace this with the library you mentioned?

Absolutely. You can find some example of FirebaseInstallations usage at our Quickstart repo, e.g. Objective-C example. Let us know if it covers your use case or you need more information.

rahul-inspired-iosdeveloper commented 4 years ago

I am using FIRInstanceID for my own debugging purpose, can I replace this with the library you mentioned?

Absolutely. You can find some example of FirebaseInstallations usage at our Quickstart repo, e.g. Objective-C example. Let us know if it covers your use case or you need more information.

Thanks @maksymmalyhin let me try FirebaseInstallations, I will come here if I need any more assistance.

rahul-inspired-iosdeveloper commented 4 years ago

Yes, the respective call would be:

[[FIRInstallations installations] installationIDWithCompletion:]

Thanks! I'll close this for now but feel free to keep commenting as needed.

Thanks @ryanwilson let me try this.

rahul-inspired-iosdeveloper commented 4 years ago

Yes, the respective call would be:

[[FIRInstallations installations] installationIDWithCompletion:]

Thanks! I'll close this for now but feel free to keep commenting as needed.

@ryanwilson I need your help in one more thing

In the previous implementation parameter type was FIRInstanceIDResult

[[FIRInstanceID instanceID] instanceIDWithHandler:^(FIRInstanceIDResult _Nullable result, NSError _Nullable error) {}];

when I am using this new library method [[FIRInstallations installations] installationIDWithCompletion:^(NSString _Nullable identifier, NSError _Nullable error) {}]

its showing this method information "The method creates or retrieves an installation ID. The installation ID is a stable identifier

I got confused with both FIRInstanceIDResult and identifier

maksymmalyhin commented 4 years ago

@rahul-inspired-iosdeveloper Let me try to clear up the confusion.

rahul-inspired-iosdeveloper commented 4 years ago

@rahul-inspired-iosdeveloper Let me try to clear up the confusion.

  • identifier returned by [[FIRInstallations installations] installationIDWithCompletion:] method is an equivalent of FIRInstanceIDResult.instanceID returned by FIRInstanceID
  • FIRInstallations migrates the legacy instance ID and uses it as an Installation ID, so in most of the cases identifier and FIRInstanceIDResult.instanceID will be the same string for a device.

Thanks @maksymmalyhin thank you very much, its all clear now.