oscarimonbox
6/2/2016 - 3:30 PM

Compartir documento con otra app

Compartir documento con otra app

1) Añadir delegate UIDocumentInteractionControllerDelegate

2) Añadir código:

	NSString* path = [self.currentPath stringByDeletingLastPathComponent];
	//path = [path stringByReplacingOccurrencesOfString:@"file:/" withString:@"file://"];
	
	NSURL *urlFile=[NSURL URLWithString:[path stringByAppendingPathComponent:file]];
	
	NSLog(@"URL de fichero: %@", urlFile);
	
	self.documentInteractionController=[UIDocumentInteractionController interactionControllerWithURL:urlFile];

	self.documentInteractionController.delegate=self;

	[self.documentInteractionController presentOptionsMenuFromRect:CGRectMake(_originX, _originY, 0, 0) inView:self.view animated:YES];
	
3) Para comprobaciones
-(void)documentInteractionController:(UIDocumentInteractionController *)controller willBeginSendingToApplication:(NSString *)application{
	NSLog(@"To App: %@", controller.URL);

}