0

我有这个网址

myString = file:///var/mobile/Containers/Data/PluginKitPlugin/-------/Documents/MyAudio.m4a

这是我的发送代码

  MSConversation * conversation = self.activeConversation;
    if (conversation) {
        MSMessageTemplateLayout * activeLayout = [[MSMessageTemplateLayout alloc] init];
       // activeLayout.image = image;
        activeLayout.caption = @"Message Counter";
        activeLayout.subcaption = @"Message subcaption";
        activeLayout.trailingCaption = @"Trailing caption";
        activeLayout.trailingSubcaption = @"Trailing Subcaption";

        activeLayout.mediaFileURL = [NSURL URLWithString:myString];

        activeLayout.imageTitle = @"Image counter";
        activeLayout.imageSubtitle = @"Image subtitle";

        MSMessage * message = [[MSMessage alloc] init];
        message.layout = activeLayout;
        message.URL = [NSURL URLWithString:@"Empty URL"];
        message.summaryText = @"This is Summary";

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

我无法获取要发送的音频文件,我只有消息计数器等。

4

1 回答 1

-1

而不是使用 insertMessage 使用 insertAttachment- [[conversation insertAttachment:[NSURL URLWithString:myString]; withAlternateFilename:@"Alternate Name" completionHandler:^(NSError * error) { DDLogInfo(@"Error is %@",error); }];

于 2017-04-24T05:11:35.287 回答