I need to use the *.pas file in my program. I think there's an mistake In this file.
- Code: Select all
procedure RegisterDevice(DeviceID : string; DeviceToken : string);
var
// Data to be sent to the script
postdata: TStringList;
//Data connection
httpconnect : TIdHTTP;
begin
try
// Create a connection
httpconnect := TIdHTTP.Create;
// Specify the data to send
postdata := TStringList.Create;
postdata.Add('action=register-device');
postdata.Add('did=' + DeviceID);
postdata.Add('token=' + DeviceToken);
{$ifdef ANDROID}
postdata.Add('platform=android');
{$else}
postdata.Add('platform=ios');
{$endif}
//send
httpconnect.Post(DOMAIN + 'push.php', postdata);
finally
// Disconnect and free up memory
httpconnect.Disconnect;
httpconnect.DisposeOf;
end;
end;
Why is there no memory release for the postdata? How correctly on pascal?
How correctly should this code look on pascal?
Thanks.