小编Edr*_*nst的帖子

更新Parse安装对象会将其删除

我使用REST API调用创建一个安装对象,如下所示:

curl -X POST \
-H "X-Parse-Application-Id: ${APPLICATION_ID}" \
-H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
    "deviceType": "ios",
    "deviceToken": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
    "channels": [
      ""
    ]
  }' \
https://<your.parseprovider.here>/1/installations
Run Code Online (Sandbox Code Playgroud)

安装对象已创建并由响应指示:

{
"objectId": "EmqGmZXGEm",
"createdAt": "2017-02-15T10:13:18.647Z"
}
Run Code Online (Sandbox Code Playgroud)

现在假设我想更新channels字段以在安装对象中包含"foo"通道,我可以简单地发出一个调用:

curl -X PUT \
-H "X-Parse-Application-Id: ${APPLICATION_ID}" \
-H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
    "channels": [
      "",
      "foo"
    ]
  }' \
https://<your.parseprovider.here>/1/installations/EmqGmZXGEm    
Run Code Online (Sandbox Code Playgroud)

然后响应表明成功:

{
"updatedAt": "2017-02-15T10:18:31.055Z"
}
Run Code Online (Sandbox Code Playgroud)

但是,当我像这样执行PUT调用时(如在REST API文档中,请注意包含deviceType和deviceToken字段):

curl -X PUT \
-H "X-Parse-Application-Id: …
Run Code Online (Sandbox Code Playgroud)

delphi parse-platform delphi-10.1-berlin

10
推荐指数
1
解决办法
204
查看次数

从类数组创建实例

我的班级定义是:

TAnimal = class(TInterfacedObject)
public
    constructor Create; overload;
    constructor Create(param : string); overload;
end;

IAnimal = interface
    procedure DoSomething;
end;

TDog = class(TAnimal, IAnimal)
public
    procedure DoSomething;
end;

TCat = class(TAnimal, IAnimal)
public
    procedure DoSomething;
end;
Run Code Online (Sandbox Code Playgroud)

示例代码:

procedure TForm1.DogButtonPressed(Sender: TObject);
var
    myDog : TDog;
    I : Integer;
begin
    myDog := TDog.Create('123');
    I := Length(myQueue);
    SetLength(myQueue, I+1);
    myQueue[I] := TDog; //Probably not the way to do it...??
end;

procedure TForm1.CatButtonPressed(Sender: TObject);
var
    myCat : TCat;
    I : Integer;
begin
    myCat := …
Run Code Online (Sandbox Code Playgroud)

arrays delphi oop polymorphism delphi-10-seattle

3
推荐指数
1
解决办法
389
查看次数