com.APNS.DecodeError

Decodes content of BYTE data returned from the APNS server in case of error.

Important:

On March 31 2021 AppleĀ® discontinued the APNs legacy binary protocol. Therefore, the com.APNS class is now desupported. The documentation pages related to the APNS binary protocol are still provided for information. Contact your support center, if you need to implement APNS with the new HTTP/2-based provider API.

Starting with Genero V5.00, the com.APNS classe will be removed from the com package.

Syntax

com.APNS.DecodeError(
   data BYTE)
  RETURNS (uuid STRING, error INTEGER)
  1. data is the BYTE variable containing the error data. This BYTE variable must be located IN MEMORY.
  2. uuid is a Base64 encoded string containing the push notification identifier.
  3. error is the APNS error code returned by the server.

Usage

This method decodes the content of the BYTE variable passed as a parameter and received as response for a push notification message in the event of an error from the APNs server.

This BYTE variable must be located IN MEMORY.

The uuid is a binary value that identifies the push notification message. It is returned as a Base64-encoded string.

The error returned value defines the APNs error code. For example, error will be set to 10 if the APNs server was shutdown. See the Apple Push Notification Service error reference for more details.

In the case of a decoding error, the method will raise the exception -15566, with details in the sqlca.sqlerrm register.

Example

DEFINE error_data BYTE,
       uuid STRING,
       error INTEGER

    LOCATE error_data IN MEMORY

    -- Send push notification message TCP request
    ...
    CALL req.doDataRequest(data)
    LET resp = req.getResponse()
    TRY
        CALL resp.getDataResponse(error_data)
        CALL com.APNS.DecodeError(error_data)
             RETURNING uuid, ecode
    ... 

For a complete example, see APNs push provider.