问题
I'm using the ExternalFileUtil-Plugin from Phonegap (https://github.com/phonegap/phonegap-plugins/tree/master/iOS/ExternalFileUtil). But it work's only at iPhone. It work's on iPhone-simulator with iOS 6.0 and 6.1 and work's on iPhone 4 and 5 with iOS 6.x. But it doesn't work on iPad, neither on simulator nore on devices and on iPod Touch with iOS 5.1 it doesn't work too ;(
I've tried any suggestions described in the comments on http://www.tricedesigns.com/2012/08/15/open-with-in-ios-phonegap-apps/ but nothing helps me.
In my opinion the following lines must be adjusted:
UIDocumentInteractionController *controller = [UIDocumentInteractionController interactionControllerWithURL:fileURL];
controller.delegate = self;
controller.UTI = uti;
[controller retain];
CDVViewController* cont = (CDVViewController*)[ super viewController ];
CGRect rect = CGRectMake(0, 0, cont.view.bounds.size.width, cont.view.bounds.size.height);
[controller presentOptionsMenuFromRect:rect inView:cont.view animated:YES];
Have somebody any suggestions?
回答1:
My current solution for this issue: Replace
CGRect rect = CGRectMake(0, 0, cont.view.bounds.size.width, cont.view.bounds.size.height);
with this
CGRect rect = CGRectMake(0, 0, 1500.0f, 50.0f);
and it works like a charm. Thanks to Mahendra Liya (see comment on tricedesigns.com).
来源:https://stackoverflow.com/questions/16481548/phonegap-plugin-externalfileutil-doesnt-work-on-all-devices