Closed kyco16 closed 9 years ago
Hey @kyco16 - no worries :smile:
It looks like your messages
is holding PFObject
s. In that case, my answer from #178 applies.
(updated for latest version of the library)
Parse allows native subclasses now, so you don't have to use a plain
PFObject
. You should subclassPFObject
, and simply have your object conform to theJSQMessageData
protocol. There's no need to edit your existing fields/properties on yourPFObject
, just implement the methods inJSQMessageData
and return the appropriate data.Then, you can simply add your
PFObject
subclass to your local datasource. (i.e., don't useJSQMessage
-- you already have your model objects)I can't tell from your snippets, but it looks like
self.messages
contains might containPFObjects
, so the cast toJSQMessage
won't work.
JSQMessageData: http://cocoadocs.org/docsets/JSQMessagesViewController/6.1.3/Protocols/JSQMessageData.html
Working with protocols: https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/WorkingwithProtocols/WorkingwithProtocols.html
@jessesquires Ah wow. You are really on point with these references. So what I should be doing is creating a custom class with a PFObject
subclass and have that conform to the JSQMessageData
protocol?
@kyco16 - exactly! let me know how that works out
Actually I just figured it out. I used this as reference since the project itself uses Parse as the backend and by looking at an example I realized what was going on.
Notification Chat: https://github.com/relatedcode/NotificationChat
It is a great reference for those are trying to use this library with the Parse backend
Thanks @kyco16 !
Please feel free to keep asking questions! :+1:
I have posted my question on StackOverflow and I haven't got many views probably because this a complex question but here is the link to My StackOverflow question. I am having trouble with this JSQMessage. I know how to take a PFObject and put them into a TableView(tableviews are pretty much the same as CollectionViews) but I do not know to transfer over or assign the values from the PFObject to the ones in JSQMessage.
I looked at question #178 and I think that was for an older version of this library. I am still learning Objective-C, a good 6 months on my own, but I am absolutely riddled when it comes to this entire library and I really want to use it. I have posted code my entire .h and .m files on my StackOverflow question as well.