将网址更改为nsstring

时间:2012-12-14 04:16:44

标签: nsstring mfmessagecomposeview

我正在尝试将电影放入我的应用内部的短信正文中。我正在使用MFMessageComposeViewController来调出消息视图。我可以将文字放入体内,但我想放一部电影。就像Apple在照片库中选择一部电影一样。 我有电影的路径和名称,我只需要将网址转换为字符串,这样我就可以将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];
    }

感谢任何人都能给予的帮助。

1 个答案:

答案 0 :(得分:0)

我认为你不能,因为我认为Apple没有给自定义应用程序提供这样的权限来向messagecomposer添加数据,但你可以使用mailcomposer执行此操作。