It's possible to receive a folder of content dropped onto an app in iOS 11 (perhaps from the Files app) by using something like this in the drop handler:
[itemProvider loadDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeFolder
completionHandler:^(NSData * _Nullable data, NSError * _Nullable error)
{
// data contains a zip of the folder's files and subfolders.
}];
But what is the correct way to set up an item provider in an app so that when the content is dropped in the other direction into the Files app, it appears as a folder containing files/subfolders?
Trying something like this doesn't work:
itemProvider = [[[NSItemProvider alloc] init] autorelease];
[itemProvider registerDataRepresentationForTypeIdentifier:(__bridge NSString *)kUTTypeFolder
visibility:NSItemProviderRepresentationVisibilityAll
loadHandler:^NSProgress* _Nullable(void (^ _Nonnull completionHandler)(NSData* _Nullable, NSError * _Nullable))
{
NSProgress *progress = ...;
NSData* data = [NSData dataWithContentsOfFile:pathToZippedFolderAndContents];
completionHandler(data, nil);
return progress;
}];