Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System messages causing app to crash #18

Open
pBread opened this issue Oct 11, 2023 · 2 comments
Open

System messages causing app to crash #18

pBread opened this issue Oct 11, 2023 · 2 comments

Comments

@pBread
Copy link

pBread commented Oct 11, 2023

Twilio Conversations assigns the "system" identity to messages created without an author. This means that some ConversationMessage records will have an identity but no participantSid.

The schema for the ConversationMessage in this app requires a participantSid property. When you attempt to view conversations with system messages, the app crashes with the log "NSLocalizedDescription=participantSid is a required value" and Xcode brings you to line 64 of ConversationsApp/Models/CoreData/CoreDataManager.swift.

Here is screenshot of Xcode during a crash

Screen Shot 2023-10-11 at 3 29 28 PM

Steps to Reproduce

  1. Log into the app
  2. Create a conversation
  3. Grab the conversationSid from the Twilio Console
  4. From the command line, create a message in the conversation with the "author" property undefined, like so...
curl -X POST "https://conversations.twilio.com/v1/Conversations/CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages" \
--data-urlencode "Body=System test" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
  1. Go back to the app, open the conversation with the system message
  2. The app should crash
@berkus
Copy link

berkus commented Oct 12, 2023

Related to #17

@hcossio
Copy link

hcossio commented Jan 26, 2024

just make the participantSid attribute as Optional. It is located in Models -> CoreData -> ConversationsApp -> Entities (PersistentMessageDataItem) click on participantSid and on the right panel click on Optional. Save. Run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants