This commit is contained in:
2025-10-23 16:04:56 +08:00
parent 28ff2b0264
commit e23ef2f814
2 changed files with 21 additions and 3 deletions

View File

@@ -172,6 +172,18 @@
}];
NSLog(@"APNSToken = %@",[FIRMessaging messaging].APNSToken);
[[FIRMessaging messaging] tokenWithCompletion:^(NSString *token, NSError *error) {
if (error) {
NSLog(@"FCM Token 生成失败:%@", error.localizedDescription);
//
// - "Unable to resolve host" Firebase
// - "Invalid project number"GoogleService-Info.plist
} else {
NSLog(@"FCM Token%@", token);
// Token Firebase Token
}
}];
}
}
@@ -180,6 +192,11 @@
return UIInterfaceOrientationMaskAll;
}
//
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
NSLog(@"推送注册失败:%@", error.localizedDescription);
}
- (void)messaging:(FIRMessaging *)messaging didReceiveRegistrationToken:(NSString *)fcmToken
{
NSLog(@"FCM registration token: %@", fcmToken);
@@ -210,6 +227,8 @@
-(void)processWithNoti:(NSDictionary *)userInfo
{
NSLog(@"Received the push notification");
NSString *message = [userInfo objectForKey:@"message"];
NSData *jsonData = [message dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *messageNotiDic = nil;