InvalidParameterException from Amazon SNS when using Firebase Cloud Messaging token from iOS
<p>I am actually trying to integrate FCM push notification feature in iOS. I created an account in the Firebase console and I am able to send notifications to the app, but problem is when I try from InvalidParameterException, I registered application in Amazon SWS, there I am getting an exception while sending notification to app.</p>

<p>Crash log:</p>

<pre><code>Caused by: com.amazonaws.services.sns.model.InvalidParameterException: Invalid parameter: Token Reason: iOS device tokens must be 64 hexadecimal characters (Service: AmazonSNS; Status Code: 400; Error Code: InvalidParameter; Request ID: 6df7d1e9-0455-5d27-a2e7-818bd3b434f0)

integration code:

token:
 eZkS-MKTCUo:APA91bFlaaure5iHcHFUBjdw_c-yyWmQp4H3OGeeb-mh6QIHSLyzehoKrM4_dbtLm3wPBrMi-vTxsHZ44pc8VNhLsOZ3H7sdhoa2WpCjpcyEZhRiJQiBiCQzGFmK7O5chAkf0pnkn2rj

code:

- (void)application:(UIApplication )application didReceiveRemoteNotification:(NSDictionary )userInfo
fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
// If you are receiving a notification message while your app is in the background,
// this callback will not be fired till the user taps on the notification launching the application.
// TODO: Handle data of notification
// Print message ID.
NSLog(@"Message ID: %@", userInfo[@"gcm.message_id"]);
// Print full message.
NSLog(@"%@", userInfo);
}
// [END receive_message]
// [START ios_10_message_handling]
// Receive displayed notifications for iOS 10 devices.
// [END ios_10_message_handling]
// [START refresh_token]
- (void)tokenRefreshNotification:(NSNotification *)notification {
// Note that this callback will be fired everytime a new token is generated, including the first
// time. So if you need to retrieve the token as soon as it is available this is where that
// should be done.
NSString *refreshedToken = [[FIRInstanceID instanceID] token];
NSLog(@"InstanceID token: %@", refreshedToken);
// Connect to FCM since connection may have failed when attempted before having a token.
[self connectToFcm];
// TODO: If necessary send token to application server.
}
// [END refresh_token]
// [START connect_to_fcm]
- (void)connectToFcm {
[[FIRMessaging messaging] connectWithCompletion:^(NSError * _Nullable error) {
if (error != nil) {
NSLog(@"Unable to connect to FCM. %@", error);
} else {
NSLog(@"Connected to FCM.");
}
}];
}
</code></pre>