所以我正在尝试发送一个大的视频文件(超过 100 mb),每当我使用 访问视频文件时dataWithContentsOfURL
,扩展都会终止。这适用于较小的文件。
我应该如何解决它?
if ([itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeMovie]){
[itemProvider loadItemForTypeIdentifier:(NSString *)kUTTypeMovie options:nil completionHandler:urlHandler];
}
NSItemProviderCompletionHandler urlHandler = ^(NSURL *item, NSError *error) {
if ([itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeVideo] | [itemProvider hasItemConformingToTypeIdentifier:(NSString *)kUTTypeMovie])
{
NSData *fileData = [NSData dataWithContentsOfURL:item]
// ----> fileData WORKS for small files.
// ----> for large files, extension QUITS - without any trace - and control does not proceed after this. This may be due to memory pressure?
[_shareExtensionActionsManager sendTextMessage:contentText attachmentData:fileData attachmentName:@"video-1" toChatEntity:_selectedItem completion:^(BOOL success)
{
[self.extensionContext completeRequestReturningItems:nil completionHandler:^(BOOL expired) {
exit(0);
}];
}];
}
};