Oh Danny Boy Oh Danny Boy - 5 months ago 63
iOS Question

Getting active MSConversation to send a message to

I am building a standalone iMessage application. I have a

which inherits from
. It seems
is always nil. Any ideas why? I am mirroring how Apple sends a message in their sample Ice Cream project.

MSConversation *conversation = [self activeConversation];
if (conversation) {
MSMessageTemplateLayout *layout = [[MSMessageTemplateLayout alloc] init];
layout.caption = @"Caption";
layout.subcaption = @"subcaption";

MSMessage *message = [[MSMessage alloc] init];
message.URL = [NSURL URLWithString:@"www.example.com"];
message.layout = layout;

[conversation insertMessage:message completionHandler:^(NSError *error) {
if (error) {
NSLog(@"Error sending message %@", [error localizedDescription]);
else {
NSLog(@"No &%#%&^# conversation found");

It may be worth noting the
is embedded in a


Turns out you can only have one instance of MSMessagesAppViewController which will actually interact with the conversation threads. Other controllers can inherit from MSMessagesAppViewController but none of the conversation protocol or compact/expanded transition delegate methods will fire in those instances, just the first instance the extension encounters.