I have recently updated My SWIFT applications pod file, And because of that firebase version is now updated to a 5.2. Which now gives me following error while getting a device instance id.
let tokenId = InstanceID.instanceID().token()
error: Use of unresolved identifier 'InstanceID'
Previously this code was working fine and I was getting Application's Instance Id.
Following is content of my pod file.
# Uncomment the next line to define a global platform for your project
# platform :ios, '11.2'
target 'FirebaseChat' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for FirebaseChat
pod 'Firebase/Database'
pod 'Firebase/Auth'
pod 'Firebase/Storage'
pod 'UnderLineTextField', '~> 2.0'
pod 'Alamofire'
pod 'TCPickerView'
pod 'Toast-Swift', '~> 3.0.1'
pod 'IQKeyboardManagerSwift'
end
Any suggestions will be helpful. Thank You.
You should import FirebaseInstanceID
import FirebaseInstanceID
Firebase made changes for token in FirebaseInstanceID update so now they changed syntaxes to get token
Try this
InstanceID.instanceID().instanceID(handler: { (result, error) in
if let error = error{
print("Error fetching remote instange ID(Token): \(error)")
}else if let result = result{
print("Remote instance ID token: \(result.token)")
}
})
and import
import FirebaseInstanceID
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With