Skip to content

Instantly share code, notes, and snippets.

@mariash
Last active August 29, 2015 14:02
Show Gist options
  • Save mariash/0f58878fb5c5aad9f6a8 to your computer and use it in GitHub Desktop.
Save mariash/0f58878fb5c5aad9f6a8 to your computer and use it in GitHub Desktop.
Importing documents in iOS application
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
if (url != nil && [url isFileURL]) {
NSError *error;
[[MYFileManager sharedInstance] importAttachment:url.path error:&error];
if (error != nil) {
[[MYAlertDisplayer sharedInstance]
displayAlert:@"Error" withMessage:@"Failed to import file"];
} else {
[[MYAlertDisplayer sharedInstance]
displayAlert:@"Success" withMessage:@"File was successfully imported"];
}
}
return YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment