Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get FCMToken in Firebase on ios?

As mentioned in Firebase documentation we can retrieve FCMToken as follows.

NSString *fcmToken = [FIRMessaging messaging].FCMToken;
NSLog(@"FCM registration token: %@", fcmToken);

However above returns compile time error Property 'FCMToken' not found on object of type 'FIRMessaging *'.

How to get FCMToken?

like image 480
isuru Avatar asked Jun 07 '17 12:06

isuru


People also ask

Does FCM token change iOS?

Instead, you should expect that the device token can change at any time. Because your app might unexpectedly get a new token, you should record that token for the user every time your app launches.


Video Answer


1 Answers

Try using :

NSString *fcmToken = [[FIRInstanceID instanceID] token];

For more information on this, please follow: stackoverflow post

like image 76
HeadOnn Avatar answered Oct 02 '22 23:10

HeadOnn