ios - JSMessageViewController = Passing PFObject into (id) -



ios - JSMessageViewController = Passing PFObject into (id<JSMessageData>) -

i using parse database store text user enters, , display onto jsmessageviewcontroller.

i having difficulty understanding why pfobject not pass, , instead, see empty message cells..

in code here can see, if pass either of // code, crashes, know nil wont work , thats why getting blank... how pass pfobject jsmessagedata ?

- (id<jsmessagedata>)messageforrowatindexpath:(nsindexpath *)indexpath { //pfobject *chat = self.chats[(nsuinteger) indexpath.row]; //return chat; //pfobject *chat = self.chats[indexpath.row]; //nsstring *message = chat[kmmkchattextkey]; //return message; homecoming nil; }

jsmessagedata has 3 instances : - (nsdate *)date, - (nsstring *)sender, , - (nsstring *)text ....

http://cocoadocs.org/docsets/jsmessagesviewcontroller/4.0.0/protocols/jsmessagedata.html

has worked ? or can help me figure out how can pass pfoject through - parse working fine, , text entered, , after when press send, stored in parse.

-(void)didsendtext:(nsstring *)text fromsender:(nsstring *)sender ondate:(nsdate *)date { if (text.length != 0){ pfobject *chat = [pfobject objectwithclassname:@"chat"]; [chat setobject:self.chatroom forkey:kmmkchatchatroomkey]; [chat setobject:self.currentuser forkey:kmmkchatfromuserkey]; [chat setobject:self.withuser forkey:kmmkchattouserkey]; [chat setobject:text forkey:kmmkchattextkey]; [chat saveinbackgroundwithblock:^(bool succeeded, nserror *error) { [self.chats addobject:chat]; //[jsmessagesoundeffect playmessagesentsound]; [self.tableview reloaddata]; [self finishsend]; [self scrolltobottomanimated:yes]; }]; } }

use objectforkey method on pfobject, , pass appropriate key retrieve text

ios objective-c iphone xcode chat

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -