Reputation: 570
In android when I want to get stable identifier that uniquely identifies the app instance I can call FirebaseInstanceId.getInstance().getId(). What is the iOS equivalent to this method in Firebase scope?
Upvotes: 1
Views: 2118
Reputation: 201
In iOS Objective C we can use like this Firebase 6.27.0
[[FIRInstanceID instanceID] getIDWithHandler:^(NSString *identity, NSError *error) {
if (error != nil) {
NSLog(@"Error fetching remote instance ID: %@", error);
} else {
NSLog(@"Remote instance ID: %@", identity);
}
NSLog(@"IID22 %@", identity);
}];
and for Token we can use this
[[FIRInstanceID instanceID] instanceIDWithHandler:^(FIRInstanceIDResult * _Nullable result,
NSError * _Nullable error) {
if (error != nil) {
NSLog(@"Error fetching remote instance ID: %@", error);
} else {
token = result.token;
}
NSLog(@"Token %@", result.token);
}];
Upvotes: 0
Reputation: 21808
I know nothing about Firebase
but after a brief peak into the docs I see it should be FIRInstanceID.instanceID().getIDWithHandler( {string, error in})
Upvotes: 2