获取新保存的PFObject的objectId

时间:2015-03-04 14:14:25

标签: objective-c parse-platform

我正在使用最新的Parse SDK并将数据发送到云数据 这是我目前的代码,但我不确定如何在成功时检索objectId:

PFObject *testObject = [PFObject objectWithClassName:@"CLASS_NAME"];
testObject[@"Name"] = firstName;
testObject[@"LastName"] = lastName;

[testObject saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) 
{
    if (succeeded) 
    {
        //success trigger
    }
}];

1 个答案:

答案 0 :(得分:5)

其内部:

PFObject *testObject

使用

访问它
NSLog(@"objectID: %@", testObject.objectId);

请参阅:https://parse.com/docs/ios/api/Classes/PFObject.html#//api/name/objectId