我正在使用Apache Cordova Facebook plugin开发facebook登录。该应用程序内置于Phonegap build - android平台。这似乎是一个非常简单的构建过程,但是我从昨天开始就遇到了这个错误。我的步骤:
步骤1.在config.xml中添加插件 - 我的文件是:
< ?xml version='1.0' encoding='utf-8'?>
<widget id="com.phonegap.helloworld" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
<name>42ch</name>
<description>Hello World sample application that responds to the deviceready event.</description>
<author email="support@phonegap.com" href="http://phonegap.com">PhoneGap Team</author>
<content src="index.html" />
<preference name="permissions" value="none" />
<preference name="orientation" value="landscape" />
<preference name="target-device" value="universal" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="true" />
<preference name="prerendered-icon" value="true" />
<preference name="stay-in-webview" value="false" />
<preference name="ios-statusbarstyle" value="black-opaque" />
<preference name="detect-data-types" value="true" />
<preference name="exit-on-suspend" value="false" />
<preference name="show-splash-screen-spinner" value="true" />
<preference name="auto-hide-splash-screen" value="true" />
<preference name="disable-cursor" value="false" />
<preference name="android-minSdkVersion" value="15" />
<preference name="android-installLocation" value="auto" />
<icon src="icon.png" />
<icon gap:platform="android" gap:qualifier="ldpi" src="www/res/icon/android/icon-36-ldpi.png" />
<icon gap:platform="android" gap:qualifier="mdpi" src="www/res/icon/android/icon-48-mdpi.png" />
<icon gap:platform="android" gap:qualifier="hdpi" src="www/res/icon/android/icon-72-hdpi.png" />
<icon gap:platform="android" gap:qualifier="xhdpi" src="www/res/icon/android/icon-96-xhdpi.png" />
<icon gap:platform="blackberry" src="www/res/icon/blackberry/icon-80.png" />
<icon gap:platform="blackberry" gap:state="hover" src="www/res/icon/blackberry/icon-80.png" />
<icon gap:platform="ios" height="57" src="www/res/icon/ios/icon-57.png" width="57" />
<icon gap:platform="ios" height="72" src="www/res/icon/ios/icon-72.png" width="72" />
<icon gap:platform="ios" height="114" src="www/res/icon/ios/icon-57-2x.png" width="114" />
<icon gap:platform="ios" height="144" src="www/res/icon/ios/icon-72-2x.png" width="144" />
<icon gap:platform="webos" src="www/res/icon/webos/icon-64.png" />
<icon gap:platform="winphone" src="www/res/icon/windows-phone/icon-48.png" />
<icon gap:platform="winphone" gap:role="background" src="www/res/icon/windows-phone/icon-173-tile.png" />
<access origin="*" />
<plugin name="cordova-plugin-whitelist" version="1" />
<gap:plugin name="com.phonegap.plugins.facebookconnect" version="0.9.0">
<param name="APP_ID" value="My APP ID" />
<param name="APP_NAME" value="MY APP NAME" />
</gap:plugin>
<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>
<engine name="android" spec="~4.1.1" />
</widget>
phonegap构建中的插件选项卡显示: 插件|来源|版本|最新|已安装|平台 com.phonegap.plugins.facebookconnect | pgb | 0.9.0 | 0.9.0 | 0.9.0 |机器人,IOS
出现错误的代码行(当我点击按钮login()时):
var login = function() {
if (!window.cordova) {
facebookConnectPlugin.browserInit('MY APP ID'); // THE CODE WHERE ERROR OCCURS
alert('a');
}
alert('b');
facebookConnectPlugin.login(["email"], function(response) {
alert('c');
if (response.authResponse) {
facebookConnectPlugin.api('/me', null,
function(response) {
alert('Good to see you, ' +
response.email + response.name + '.');
});
}
});
}
任何帮助都将非常感激。我的代码位于https://github.com/sandeepy02/42c
答案 0 :(得分:0)
@ user1517108,
很明显这是你的第一个应用程序。请从现在开始阅读blog。你最近的博客帖子犯了两(2)个错误。
使用此条目代替您拥有的内容。
<plugin name="cordova-plugin-facebookconnect-orlando" spec="0.11.0" />
您还应该在如何编写插件条目上read the documentation。这已经改变了。有关详细信息,请阅读blog post。 - 最好的运气。