FileTransfer未定义 [英] FileTransfer is not defined

查看:153
本文介绍了FileTransfer未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在离子2应用程序中使用传输插件来发送文件。在测试应用程序时,我很难模拟转移。请查看此问题以了解相关信息。在讨论之后,我决定在我的服务中注入转移

I am using Transfer plugin in my ionic 2 app for sending files. While testing the app, I had difficulty in mocking Transfer. Please take a look into this problem to understand the context . After that discussion , I decided to inject Transfer in my service.

所以我添加了在我的提供商中转移 app.module.ts 。并将其注入我的服务。

So I added Transfer in my providers in app.module.ts.And injected it into my service.

构造函数(公共转移:转移){}

但这会导致错误。 未定义FileTransfer 。我猜是因为这个插件没有浏览器支持。所以我处在一个困难的地方,我不知道如何制作可测试的代码。任何想法?

But this leads to an error. FileTransfer is not defined. I guess its because there is no browser support for this plugin. So I am in a tough spot, I do not know how I can make working testable code. Any ideas?

推荐答案

浏览器不支持离子cordova插件因为浏览器无法访问操作系统的原生api所以你需要开发应用程序并将其置于Android或ios设备中。

In ionic cordova plugin are not supported for browser Because the browser cant access native api of the os so you need to develop the app and deply it in your Android or ios device .

这篇关于FileTransfer未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆