Closed Immons closed 2 years ago
So there seems to be exactly two issues.
First one is inside NotificationToXam assigning relevance score that way:
relevanceScore = (float) notification.RelevanceScore,
in this case, it will throw NullReferenceException, fix for that should be:
relevanceScore = notification.RelevanceScore != null ? (float) notification.RelevanceScore : 0,
and the second problem, is this line:
additionalData = Json.Deserialize(notification.AdditionalData.ToString()) as Dictionary<string, object>,
it "deserializes" to null, the solution could be code from your 3.10 implementation:
var additionalData = new Dictionary<string, object>();
if (notification.AdditionalData != null)
{
foreach (KeyValuePair<NSObject, NSObject> element in notification.AdditionalData)
{
additionalData.Add((NSString)element.Key, element.Value);
}
}
@Immons Thanks for reporting, providing the code, and reviewing the PR above!
Just to let you know we have the fix included in the 3.0.0-beta4 release: https://github.com/OneSignal/OneSignal-Xamarin-SDK/releases/tag/4.0.0-beta4
Description:
I am sending notification through REST API, it was working fine with OneSignal 3.x, but when updated to 4.0.0 beta 3, it crashes with following stack trace.
Environment
Steps to Reproduce Issue:
Example:
Anything else: