I am building a standalone iMessage application. I have a UIViewController
which inherits from MSMessagesAppViewController
. It seems activeConversation
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 UIViewController
is embedded in a UINavigationController
.