Reputation: 385
I'm developing a chat app and I'm using Parse for backend. I have a Discussion table to save Discussion between 2 user.
@interface Discussion : PFObject <PFSubclassing>
@property (nonatomic, retain) PFUser * customer;
@property (nonatomic, retain) PFUser * creator;
@property (nonatomic, retain) Quote * quote;
@property (nonatomic, retain) NSDate * lastMessageTime;
@property long messageCount;
@end
I have a Message table to save message.
@interface Message : PFObject <PFSubclassing>
@property (nonatomic, retain) PFUser * sender;
@property (nonatomic, retain) Discussion * discussion;
@property (nonatomic, retain) NSString * content;
@property (nonatomic, retain) PFFile * image;
@property (nonatomic, retain) PFFile * imageThumb;
@property (nonatomic, retain) PFFile * video;
@property (nonatomic, retain) PFFile * videoThumb;
@property (nonatomic, retain) PFGeoPoint * location;
@property (nonatomic, retain) PFFile * sound;
@end
When user chatting, I use cloud code to update lastMessageTime and messageCount. I want to show a list of people with small label that shows messageCount, and I have a NSTimer to call it automatically each 3.0 seconds.
But when I get new Dicussion, its estimatedData and serverData do not matchs.
I have no idea about this. Please give me your advice.
Upvotes: 0
Views: 122
Reputation: 680
I have same problem when working on Android Parse SDK.
I think you have edited messageCount
on both server side via Cloud Code script and client side via Object-C.
To fix it, you must edit only on client side or server side and sync to another side.
Thanks.
Upvotes: 1