0
我試圖理解Parse.com的雲代碼,但它非常困難。我的問題是,我想重寫它操作在雲代碼數組(JavaScript)的解析 - Obj-C到Cloud代碼
下面是一些代碼
PFQuery * quer = [PFQuery queryWithClassName:@"Spel"];
NSString * playerID = [[PFUser currentUser] objectForKey:@"fbid"];
[quer whereKey:@"lobby" containsAllObjectsInArray:@[playerID]];
[quer findObjectsInBackgroundWithBlock:^(NSArray * _Nullable objects, NSError * _Nullable error) {
for (PFObject * obj in objects) {
if (!error) {
NSMutableArray * ready = [[obj objectForKey:@"ready"] mutableCopy];
if (![ready containsObject:[[PFUser currentUser] objectForKey:@"fbid"]]) {
[ready addObject:[[PFUser currentUser] objectForKey:@"fbid"]];
}
[obj setObject:ready forKey:@"ready"];
[obj saveInBackgroundWithBlock:^(BOOL succeeded, NSError * _Nullable error) {
if (succeeded) {
//success}
我想在雲中的代碼相同的代碼運行查詢,由於這是一款多人遊戲,並且人們同時點擊該按鈕,因此存在數組操作錯誤的問題。
某種靈魂在那裏誰會知道如何?因爲它感覺比剛纔節省了雲代碼
親切的問候, 馬丁正常對象稍微複雜