Home:ALL Converter>How To Move A File Out Of The Inbox Folder When Using Airdrop Between iOS Devices

How To Move A File Out Of The Inbox Folder When Using Airdrop Between iOS Devices

Ask Time:2017-02-14T22:12:03         Author:Eric Hartner

Json Formatter

I am sending database file successfully between iOS devices with the following code:

-(void) doSendDatabase {
UIView *viewTemp = [[UIView alloc] init];
viewTemp.frame = CGRectMake(0.0f, 0.0f, 300, 300);

NSString *currentDatabaseName;

// This is the full path and file name with ext
currentDatabaseName = [self.databases objectAtIndex:[[mainTableView indexPathForSelectedRow] row]];

NSURL *url = [[NSURL alloc] initFileURLWithPath:currentDatabaseName];

UIActivityViewController * airDrop = [[UIActivityViewController alloc]
                                         initWithActivityItems:@[url]
                                         applicationActivities:nil];    

airDrop.popoverPresentationController.sourceView = self.view;

[self presentViewController:airDrop
                   animated:YES
                 completion:nil];

[url release];
[airDrop release];
[viewTemp release];}

This code works and the database successfully gets sent from the sending iOS device to the receiving device. However, the databases are stored in the Documents/Inbox folder (by design I suppose). I simply want to move the received database files from the Inbox folder up one level into the Documents folder. From what I'm reading I need to handle this in openURL in the App Delegate - but am not sure how to go about this. Any help would be greatly appreciated.

Thank you.

Author:Eric Hartner,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/42228384/how-to-move-a-file-out-of-the-inbox-folder-when-using-airdrop-between-ios-device
yy