【发布时间】:2016-12-07 19:10:05
【问题描述】:
我使用 ionic2 创建了一个应用程序,并使用 firebase 在 facebook 中进行连接。所以我的问题是在网络浏览器中使用的应用程序可以正常工作,但是当我尝试在我的设备上运行时出现此错误?
code: "auth/network-request-failed", message: "A network error (such as timeout, interrupted connection or unreachable host) has occurred."
好的,我知道设备可以连接,所以我的设备有 4g 连接和 wifi,并且可以在其他应用程序中正常工作。
所以,我验证了 cordova config.xml 并向我展示了<access origin="*"/>,我阅读了生成的 AndroidManifest 并有一个 <uses-permission android:name="android.permission.INTERNET" />。
我不知道什么是wearg,这是我第一次使用ionic 和cordova,有人可以帮助我吗?
我的 package.json:
{
"name": "xxx",
"author": "Ricardo",
"homepage": "http://www.example.com",
"private": true,
"scripts": {
"build": "ionic-app-scripts build",
"watch": "ionic-app-scripts watch",
"serve:before": "watch",
"emulate:before": "build",
"deploy:before": "build",
"build:before": "build",
"run:before": "build"
},
"dependencies": {
"@angular/common": "^2.0.0",
"@angular/compiler": "^2.0.0",
"@angular/compiler-cli": "0.6.2",
"@angular/core": "^2.0.0",
"@angular/forms": "^2.0.0",
"@angular/http": "^2.0.0",
"@angular/platform-browser": "^2.0.0",
"@angular/platform-browser-dynamic": "^2.0.0",
"@angular/platform-server": "^2.0.0",
"@angular/router": "^2.0.0-rc.2",
"@ionic/storage": "^1.0.3",
"angularfire2": "^2.0.0-beta.5",
"cordova": "^6.3.1",
"firebase": "^3.5.0",
"ionic-angular": "^2.0.0-rc.1",
"ionic-native": "^2.2.7",
"ionicons": "^3.0.0",
"ng2-image-lazy-load": "^2.0.9",
"rxjs": "5.0.0-beta.12",
"zone.js": "^0.6.21"
},
"devDependencies": {
"@ionic/app-scripts": "^0.0.33",
"@types/request": "0.0.30",
"ng2-facebook": "0.0.3",
"ng2-facebook-sdk": "^1.0.0",
"reflect-metadata": "^0.1.2",
"typescript": "^2.0.3"
},
"description": "xxx: ",
"cordovaPlugins": [],
"cordovaPlatforms": [],
"config": {
"ionic_rollup": "./config/rollup.config.js",
"ionic_copy": "./config/copy.config.js"
}
}
还有我的 config.xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="br.com.xxx.app" version="2.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>xxx</name>
<description>An awesome Ionic/Cordova app.</description>
<author email="xxx@gmail.com" href="http://www.example.com">xxx Team</author>
<content src="index.html"/>
<access origin="*"/>
<allow-intent href="http://*/*"/>
<allow-intent href="https://*/*"/>
<allow-intent href="tel:*"/>
<allow-intent href="sms:*"/>
<allow-intent href="mailto:*"/>
<allow-intent href="geo:*"/>
<platform name="android">
<allow-intent href="market:*"/>
</platform>
<platform name="ios">
<allow-intent href="itms:*"/>
<allow-intent href="itms-apps:*"/>
</platform>
<preference name="webviewbounce" value="false"/>
<preference name="UIWebViewBounce" value="false"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="android-minSdkVersion" value="16"/>
<preference name="BackupWebStorage" value="none"/>
<preference name="SplashScreenDelay" value="0"/>
<preference name="FadeSplashScreen" value="false"/>
<preference name="FadeSplashScreenDuration" value="0"/>
<preference name="SplashScreenBackgroundColor" value="0xFFFFFFFF"/>
<feature name="StatusBar">
<param name="ios-package" onload="true" value="CDVStatusBar"/>
</feature>
<plugin name="cordova-plugin-facebook4" spec="~1.7.4">
<variable name="APP_ID" value="99999999999"/>
<variable name="APP_NAME" value="xxx"/>
</plugin>
</widget>
【问题讨论】:
-
你错过了
cordova-plugin-whitelist?? github.com/apache/cordova-plugin-whitelist -
cordova 版本 6 中不再需要此插件