2016-12-07 22 views
0

私はionic2を使用し、firebaseを使用してFacebookに接続するアプリを作成しました。だから私の問題は、アプリケーションが正常に動作するWebブラウザで使用されるアプリですが、私は私のデバイス上で実行しようとすると、このエラーが表示されます?Ionic2/cordovaがインターネットに接続できません

code: "auth/network-request-failed", message: "A network error (such as timeout, interrupted connection or unreachable host) has occurred." 

[OK]をクリックすると、デバイスが接続できるようになるため、デバイスに4g接続とWi-Fiがあり、他のアプリケーションで正常に動作します。 私はcordovaのconfig.xmlを確認して<access origin="*"/>と表示され、生成されたAndroidManifestを読み、<uses-permission android:name="android.permission.INTERNET" />となっています。

私は何が悪いのか分かりません。私はイオンとコードワで初めてです。だれでも助けてくれますか?

私の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:あなたのindex.htmlで

<?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="[email protected]" 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> 
+0

'cordova-plugin-whitelist'はありませんか? https://github.com/apache/cordova-plugin-whitelist – Akis

+0

このプラグインはコードワバージョン6では不要です。 – Ricardo

答えて

1

、私はあなたがすでにContent-Security-Policyを持っていることを前提としています。
次のように交換してください。

<meta http-equiv="Content-Security-Policy" content="default-src * gap://ready file:; style-src 'self' 'unsafe-inline' *; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; img-src * data: 'unsafe-inline'"> 
+0

この解決策は私のために働いていました。ただし、安全でないコードがこのコード行に使用された回数を指定すると、これは安全な解決策ですか? :D –

関連する問題