From 56b0c4ddd672a4bc168c3a50bbba53f1075594e7 Mon Sep 17 00:00:00 2001 From: Seamus Campbell Date: Thu, 5 Mar 2015 17:58:39 -0800 Subject: [PATCH] Fix compile errors; add file-exists test and logging. --- src/ios/FileOpener2.m | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/ios/FileOpener2.m b/src/ios/FileOpener2.m index 2b32e6d..b76083c 100644 --- a/src/ios/FileOpener2.m +++ b/src/ios/FileOpener2.m @@ -42,14 +42,21 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. NSArray *dotParts = [path componentsSeparatedByString:@"."]; NSString *fileExt = [dotParts lastObject]; - NSString *uti = (__bridge NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)fileExt, NULL); + uti = (__bridge NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)fileExt, NULL); } dispatch_async(dispatch_get_main_queue(), ^{ - //NSLog(@"path %@, uti:%@", path, uti); NSURL *fileURL = [NSURL fileURLWithPath:path]; localFile = fileURL.path; + + NSLog(@"looking for file at %@", fileURL); + NSFileManager *fm = [NSFileManager defaultManager]; + if(![fm fileExistsAtPath:localFile]) { + NSLog(@"couldn't find file!"); + } else { + NSLog(@"file located, handing off to UIDocumentInteractionController"); + } self.controller = [UIDocumentInteractionController interactionControllerWithURL:fileURL]; self.controller.delegate = self; @@ -57,7 +64,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. CGRect rect = CGRectMake(0, 0, 1000.0f, 150.0f); CDVPluginResult* pluginResult = nil; - BOOL wasOpened = [docController presentOptionsMenuFromRect:rect inView:cont.view animated:NO]; + BOOL wasOpened = [self.controller presentOptionsMenuFromRect:rect inView:cont.view animated:NO]; if(wasOpened) { pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString: @""];