简体   繁体   中英

iOS FCM not working on downloaded app from AppStore Obj-C

So i have this in my info.plist

FirebaseAppDelegateProxyEnabled = NO 

I am using .p8 (APNs Authentication Key) for my firebase project configuration. I don't generate and use the APNs Certificates (development or production certificate)

When i am testing using Xcode, both debug and release mode are working fine. all my devices can receive the FCM with no problem.

However, when I try to download the App from App Store and fire some FCMs, all the device did not receive the message.

this is how i set the APNs token

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
NSLog(@"APNs device token retrieved: %@", deviceToken);

[[FIRMessaging messaging] setAPNSToken:deviceToken type:FIRMessagingAPNSTokenTypeSandbox];
}

I have updated all my firebase pod to the newest one. And i am currently using FirebaseMessaging 2.0.7. FYI, i don't put in any App Store ID to my firebase configuration.

Am I missing something? Any help given is so highly appreciated.

Thanks

Maybe I'm late, but you are configuring your FCM SDK for debug token by using

FIRMessagingAPNSTokenTypeSandbox

So the release build won't work.

Unless you have disabled swizzling you just doesn't need that line:

[[FIRMessaging messaging] setAPNSToken:deviceToken type:FIRMessagingAPNSTokenTypeSandbox];

Anyway if you have disabled swizzling (as you did)

by setting FirebaseAppDelegateProxyEnabled to NO in your app's Info.plist

You need to specify the APN token:

Swizzling disabled: mapping your APNs token and registration token If you have disabled method swizzling, you'll need to explicitly map your APNs token to the FCM registration token. Override the methods didRegisterForRemoteNotificationsWithDeviceToken to retrieve the APNs token, and then set FIRMessaging's APNSToken property:

#ifdef DEBUG
[[FIRMessaging messaging] setAPNSToken:deviceToken type:FIRMessagingAPNSTokenTypeSandbox];
#else
[[FIRMessaging messaging] setAPNSToken:deviceToken type:FIRMessagingAPNSTokenTypeProd];
#endif

Or just

[[FIRMessaging messaging] setAPNSToken:deviceToken type:FIRMessagingAPNSTokenTypeUknown];

or

[FIRMessaging messaging].APNSToken = deviceToken;

The APNS token type for the app. If the token type is set to UNKNOWN Firebase Messaging will implicitly try to figure out what the actual token type is from the provisioning profile. Unless you really need to specify the type, you should use the APNSToken property instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM