我正在使用此代码将视频从DocumentDirectory
复制到Pasteboard
。
let data: NSData = NSData(contentsOfURL: NSURL(fileURLWithPath: outputurl))!
let pasteBoard: UIPasteboard = UIPasteboard.generalPasteboard()
pasteBoard.setData(data, forPasteboardType: String(kUTTypeVideo))
现在任何人都可以帮助我如何获取此视频并在不同的地方使用从粘贴板。
答案 0 :(得分:1)
请参阅下面的Objective-C代码,希望您可以将其转换为swift:
APIs
用于从Pasteboard读取数据。
//returns data
- (NSData *)dataForPasteboardType:(NSString *)pasteboardType;
//returns value
- (id)valueForPasteboardType:(NSString *)pasteboardType;
示例:
UIPasteboard * pasteboard=[UIPasteboard generalPasteboard];
NSData * data = [pasteboard dataForPasteboardType:(NSString*)kUTTypeVideo];
有关详细信息,请查看此处的文章:
答案 1 :(得分:0)
迅速版Ronak的答案
import MobileCoreServices
let pasteboard = UIPasteboard.general
let data = UIPasteboard.general.data(forPasteboardType: kUTTypeQuickTimeMovie as String)