iosswiftxcodeimessageimessage-extension

activeConversation is always nil while developing iMessage App


When I create a sample iMessage app project and run it on my device, it consistently displays the error message 'Error creating the CFMessagePort needed to communicate with PPT.' Additionally, when I attempt to print the value of 'activeConversation,' it always returns 'nil.

I am expecting that activeConversation shouldn't be nil.


Solution

  • I was actually developing an app in which I wanted to send a message from the app when a user taps on a button. I intended to send a message directly from my extension, but I encountered an error where 'activeConversation' returned 'nil,' even though I expanded the screen and the message wasn't being sent. I resolved this issue by removing navigation controller from the initial view controller. When I add navigation controller to initial view controller it always gives me nil value of activeConversation.