你可以在你的PFUser類中創建一個字段設置的數據:@「看」
然後用這個作爲一個數組,所以每當用戶點擊的東西看...
[[PFUser currentUser]addObject:objectToWatch.objectId forKey:@"watching"]; // adds it to the array
[[PFUser currentUser]save];
// something about arrays and parse objects, if you're using operations like "addObject" you should save or you'll get errors.
// the other option is to get an NSMutableArray from the array field, edit that, and reassociate it with the @"watching" key ... whichever you prefer
我們現在有標識的使用對象觀看相關的數組。你可以查詢像這樣
PFQuery * query = [PFQuery queryWithClassName:@"ObjectsToWatch"];
[query whereKey:@"objectId" containedIn:[PFUser currentUser][@"watching"]];
[query findObjectsInBackground]; // use a block method though
這是唯一一個做到這一點的方式,希望它有助於