Phonegap-Plugin ExternalFileUtil doesn't work on all devices

青春壹個敷衍的年華 提交于 2019-12-11 05:05:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!