0

我是phonegap的新手。我在ios中使用cordova1.5。如果我在没有 *.doc 的情况下通过 broswer 打开,一切都会好起来的,我仍然会得到 fileSytem。例如:gif、jpg、png、txt、html、pdf。

在我通过浏览器打开 *.doc 并关闭新视图后。childBroswer(plugin),default webview,"file:///"(location),"http://"(net),所有的origin webview都不会再获取fileSystem了。

它是一个错误吗?正常吗?

4

1 回答 1

0

不确定您是否设法解决了这个问题,但是:Cordova 扩展了 NSMutableArray 以添加一个 pop 方法。当您打开一个 Word 文档时,查看器会覆盖 Cordova 版本的 pop,当您返回应用程序时,Cordova 开始使用该版本。

为确保您遇到相同的问题,请创建一个多次调用 [argument pop] 的插件。加载 word 文档后,您应该注意到行为发生了变化。

您可以通过执行以下代码来解决它,您需要在显示文档之前存储 store 方法,并在关闭它后调用 restore 。

导入 objc/runtime.h 导入 o​​bjc/message.h

@执行 ...

静态 IMP cordovaPopImplementation = NULL; 静态 const char* cordovaPopEncoding = NULL;

+(void)storeCordovaPop { 方法 popMethod = class_getInstanceMethod([NSMutableArray class], @selector(pop)); if (!cordovaPopImplementation) { cordovaPopImplementation = method_getImplementation(popMethod); cordovaPopEncoding = method_getTypeEncoding(popMethod); } }

+(void)restoreCordovaPop {
class_replaceMethod([NSMutableArray 类],@selector(pop),cordovaPopImplementation,cordovaPopEncoding); }

于 2012-05-31T01:29:15.883 回答