iOS集成Flurry推送通知遇UnrecognizedDeviceId错误求助
Hey there, let’s dig into this UnrecognizedDeviceId issue you’re hitting with Flurry Push on your iPhone 7 Plus (iOS 13.3.1). You’ve already covered the basic checks, so let’s focus on some less obvious fixes that might resolve this:
Possible Fixes to Try
1. Verify Environment Match Between Apple Cert and Flurry Console
Since you’re using an Apple Push Sandbox SSL Certificate, make sure your Flurry dashboard’s push configuration is set to the Sandbox environment. Sandbox and Production device tokens are not interchangeable—mismatching these will definitely trigger the UnrecognizedDeviceId error.
2. Pass the Raw NSData Device Token to Flurry
Your current code converts the device token to a base64 string, but Flurry’s setDeviceToken: expects the original NSData object, not a string. Update your didRegisterForRemoteNotificationsWithDeviceToken method like this:
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { // Pass the raw NSData directly to Flurry [FlurryMessaging setDeviceToken:deviceToken]; // Keep your logging for verification (optional) NSString* tokenString = [deviceToken base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithLineFeed]; NSLog(@"The generated device token string is : %@",tokenString); }
Double-check that this method is firing after Flurry has started its session (your current setup should handle this, but it’s worth confirming).
3. Disable Auto-Integration and Handle Push Setup Manually
The setAutoIntegrationForMessaging flag might be conflicting with your manual device token setup. Try disabling it and handling notification authorization/registration yourself:
- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Comment out auto-integration // [FlurryMessaging setAutoIntegrationForMessaging]; [FlurryMessaging setMessagingDelegate:self]; FlurrySessionBuilder* builder = [[FlurrySessionBuilder alloc] withIncludeBackgroundSessionsInMetrics:YES]; [builder withLogLevel:FlurryLogLevelAll]; [Flurry startSession:@"XXXXXX" withOptions:launchOptions withSessionBuilder:builder]; // Manually request notification permissions UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; center.delegate = self; [center requestAuthorizationWithOptions:(UNAuthorizationOptionAlert + UNAuthorizationOptionSound + UNAuthorizationOptionBadge) completionHandler:^(BOOL granted, NSError * _Nullable error) { if (granted) { dispatch_async(dispatch_get_main_queue(), ^{ [[UIApplication sharedApplication] registerForRemoteNotifications]; }); } }]; return YES; }
This ensures full control over how the device token is passed to Flurry, eliminating auto-integration conflicts.
4. Check IDFA/IDFV Collection Setup
Even though you confirmed your IDFA/IDFV is correct, verify:
- Your app has the necessary permissions to access IDFA (for iOS 13, you don’t need the
NSUserTrackingUsageDescriptionyet, but ensure you’re collecting it properly before initializing Flurry). - Your Flurry dashboard has IDFA/IDFV tracking enabled for your app project.
5. Dig Into Flurry’s Detailed Logs
You’ve set FlurryLogLevelAll, so scan your Xcode console for Flurry-specific logs. Look for lines indicating whether the device token was successfully sent to Flurry’s servers, or any error messages related to device registration. These logs often contain clues that aren’t visible in the dashboard error.
6. Clear Caches and Wait for Sync
Sometimes server-side caching or delayed sync can cause this issue:
- Restart your iPhone 7 Plus.
- Delete and reinstall your app.
- After re-registering for push, wait 5-10 minutes before testing again in the Flurry console—device data can take a moment to sync to their servers.
If none of these steps work, reach out to Flurry’s support team with your API key, device token (from your NSLog), console configuration screenshots, and Xcode log snippets. They’ll have direct access to their server logs to pinpoint the issue.
内容的提问来源于stack exchange,提问作者vava044

