public bool IsIosExceedLength()
{
if (this.notification != null)
{
if (this.notification.IosNotification != null)
{
var iosJson = JsonConvert.SerializeObject(this.notification.IosNotification, jSetting);
if (iosJson != null)
{
return UTF8Encoding.UTF8.GetBytes(iosJson).Length > MAX_IOS_PAYLOAD_LENGTH;
}
}
else
{
if (!(this.notification.alert == null))
{
string jsonText;
using (StringWriter sw = new StringWriter())
{
JsonWriter writer = new JsonTextWriter(sw);
writer.WriteValue(this.notification.alert);
writer.Flush();
jsonText = sw.GetStringBuilder().ToString();
}
return UTF8Encoding.UTF8.GetBytes(jsonText).Length > MAX_IOS_PAYLOAD_LENGTH;
}
else
{
// No iOS Payload
}
}
}
return false;
}