0

I'm playing with JSQMessagesViewController. My first project I did using Raywenderlich's Firebase Tutorial: Real-time Chat tutorial.

Then I created a new project to play more with JSQMessagesViewController. And in this new project I'm having issue now.

After I import JSQMessagesViewController and add it as a super class for my ViewController, I got this error in my console -

Assertion failure in -[NewProject.ViewController viewWillAppear:], /Users/Downloads/ChatChatFirebaseTutorial-finished/Pods/JSQMessagesViewController/JSQMessagesViewController/Controllers/JSQMessagesViewController.m:233 2017-05-30 20:43:44.498 NewProject[10688:314277] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: self.senderId != nil'

I see message from ChatChatFirebaseTutorial(am I right?) my previous project in my new project.

So, I deleted everything what was about ChatChatFirebaseTutorial and even more from my mac. It didn't help. I uninstalled and installed pods from project and mac few times. It didn't help.

Did anyone has this issue before? If yes, how did you solve it?

Shamas S
  • 7,507
  • 10
  • 46
  • 58
Jonagold
  • 81
  • 1
  • 9
  • My issue was solved [here.](https://stackoverflow.com/questions/31796471/how-to-push-a-jsqmessagesviewcontroller-correctly) Thanks! – Jonagold May 31 '17 at 02:22

1 Answers1

0

The Library requires that you set a senderID for the current user. This can be done by adding a function like this to your class

override func senderId() -> String {
    return "UNIQUEID"
}

I would use something you know is going to be unique such as an email or a unique Id you generate just associated to the user so you can determine who sent the messages.

Pang
  • 9,564
  • 146
  • 81
  • 122
Dan Leonard
  • 3,325
  • 1
  • 20
  • 32