SimulatorRemoteNotifications
SimulatorRemoteNotifications copied to clipboard
Updated notification payload size for iOS >= 8
Hello! First of all, I'd like to thank you for this nice tool!
I'm trying to simulate some notifications on an iOS 9 device, which supports a new payload size limit of either 2KB or 4KB. However, SimulatorRemoteNotification seems to truncate the payload after a certain amount of bytes (256?), which results in the following error:
SimulatorRemoteNotification: error = Error Domain=NSCocoaErrorDomain Code=3840
"Unterminated string around character 313." UserInfo={NSDebugDescription=Unterminated
string around character 313.}
I tried multiplying the values of the following constants by 8, but this seemed to have no effect:
UIApplication+SimulatorRemoteNotifications.m\SimulatorRemoteNotificationsBufferLength
ACSimulatorRemoteNotificationsService.m\SimulatorRemoteNotificationsServiceBufferLength
How can the code be modified to support the increased payload size?
P.S. I know the payload I'm testing is valid because it gets delivered successfully through APNS when testing with a real device.
(Edit: updated the link to the documentation where the payload size is discussed)
@Dev-iL I tried changing SimulatorRemoteNotificationsBufferLength in both UIApplication+SimulatorRemoteNotifications.m and ACSimulatorRemoteNotificationsService.m to 2048 and was able to successfully receive larger payloads.
Maybe try cleaning your project / deleting your derived data before rebuilding?
@panupan I'll try it again. Did you also try it with the 4KB payload alternative?
@Dev-iL Nope, only tried with 2KB which was working perfectly.