ios - i want to see instanceId for firebaseNotification in viewController by NSLog after receiving it from firebase -
i can instanceid firebase notification on appdelegate.m takes few seconds after app loaded. , want store server can't send server. why can't send push notification individually. so, please how should do , following code.
//appdelegate.m #import "appdelegate.h" @import firebase; @import firebasemessaging; @interface appdelegate () @end @implementation appdelegate - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { // override point customization after application launch. [firapp configure]; [[uiapplication sharedapplication] setapplicationiconbadgenumber:0]; // add oberver handling token refresh callback [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(tokenrefreshcallback:) name:kfirinstanceidtokenrefreshnotification object:nil]; // request permission notifications user uiusernotificationtype allnotificationtypes = (uiusernotificationtypesound | uiusernotificationtypealert | uiusernotificationtypebadge); uiusernotificationsettings *settings = [uiusernotificationsettings settingsfortypes:allnotificationtypes categories:nil]; [application registerusernotificationsettings:settings]; //request device token apple push notification services [application registerforremotenotifications]; return yes; return yes; } - (void)tokenrefreshcallback: (nsnotification *)notification { nsstring *refreshtoken = [[firinstanceid instanceid] token]; nslog(@"instanceid token: %@", refreshtoken); [self connecttofirebase]; }
i want store refreshtoken server when user installed app on first time. please, me. going crazy now.
Comments
Post a Comment