0

我正在尝试从我的应用程序内部将一部电影放入短信的正文中。我正在使用 MFMessageComposeViewController 来调出消息视图。我可以将文本放入正文,但我想放入电影。就像 Apple 在照片库中选择电影时所做的那样。我有电影的路径和名称,我只需要将 url 转换为字符串,这样我就可以使用 body = 了。这是我的代码

NSString *audioName = [pictureDictionary2 objectForKey:@"photoVideokey"];
    NSArray *pathsa = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectorya = [pathsa objectAtIndex:0];
    //Get a full path to the image in the documents directory.
    NSString *fullPatha = [documentsDirectorya stringByAppendingPathComponent:audioName];
    self.sharingImage = [NSURL fileURLWithPath:fullPatha];
    NSURL *url1 = [NSURL fileURLWithPath:fullPatha];
    NSData *videoData = [[NSData alloc] initWithContentsOfURL:url1];

//I know this isn't right and I have tried several things but can't seem to solve it.
    NSString* theString = [NSURL fileURLWithPath:fullPatha];



    MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init];
    if([MFMessageComposeViewController canSendText])
    {
        controller.body = theString;

        controller.messageComposeDelegate = self;
        if (controller) [self presentViewController:controller animated:YES completion:NULL];
    }

感谢任何人都可以提供的任何帮助。

4

1 回答 1

0

我认为您不能这样做,因为我认为 Apple 并未授予自定义应用程序向 messagecomposer 添加数据的此类权限,但您可以使用 mailcomposer 执行此操作。

于 2012-12-20T09:47:32.160 回答