Answer the question
In order to leave comments, you need to log in
How to transfer data between ios applications?
There is a task to transfer data from one application to another. I looked in the direction of extensions, and specifically the Document Provider, but did not fully understand how to use it and whether it suits my needs.
The task is complicated by the fact that I do not have a Developer Program and therefore there are no options for working through iCloud.
Any ideas how to deal with this?
Answer the question
In order to leave comments, you need to log in
Everything is quite simple, the application that sends the data must create a
UIDocumentInteractionController;
UIDocumentInteractionController *_controller;
if(!_controller)
_controller = [[UIDocumentInteractionController alloc]init];
_controller.delegate = self;
NSURL *documentURL = @"тут должен быть урл в файловой системе, в который записаны данные которые нужно передать";
_controller.URL = documentURL;
if(![_controller presentOpenInMenuFromRect:cell.frame inView:self animated:YES])
{
NSLog(@"can't open in another app");
}
else
NSLog(@"Open in another app");
// ну и делигат методы
- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller {
return self;// это вьюв контроллер в котором будет всплывающее меню с выбором аппа который будет открывать.
}
- (void)documentInteractionController:(UIDocumentInteractionController *)controller willBeginSendingToApplication:(NSString *)application {
NSLog(@"Starting to send this puppy to %@", application);
}
- (void)documentInteractionController:(UIDocumentInteractionController *)controller didEndSendingToApplication:(NSString *)application {
NSLog(@"We're done sending the document.");
}
NSURL *url = (NSURL *)[launchOptions valueForKey:UIApplicationLaunchOptionsURLKey];
NSData* data = [NSData dataWithContentsOfURL:url];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question