0
我試圖把電影轉換爲文本消息的主體從我的應用程序中。我正在使用MFMessageComposeViewController來調出消息視圖。我可以把文字放進身體,但我想放一部電影。就像Apple在照片庫中選擇一部電影時所做的一樣。 我有電影的路徑和名稱,我只需要將url轉換爲一個字符串,所以我可以有body =它。這裏是我的代碼改變網址的NSString
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];
}
感謝任何幫助,任何人都可以給。