I have implemented Firebase cloud messaging in my app for push notifications. Everything working fine. But notifications are getting even user logged out from app.
I heard that, I need to delete the FCM token when user logged out from app.
So I did like this in logout method:
-(void)logout{
[[FIRInstanceID instanceID] deleteIDWithHandler:^(NSError *error){
NSLog(@"%@",error);
}];
}
But this is not working and next time when user logged in [[FIRInstanceID instanceID]token]
is coming as null
.
How to do this?