Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/402.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript phonegap socialsharing错误:无法读取未定义的属性“socialsharing”_Javascript_Android_Cordova_Share_Socialshare - Fatal编程技术网

Javascript phonegap socialsharing错误:无法读取未定义的属性“socialsharing”

Javascript phonegap socialsharing错误:无法读取未定义的属性“socialsharing”,javascript,android,cordova,share,socialshare,Javascript,Android,Cordova,Share,Socialshare,我建立我的应用程序,所以需要使用社交共享。。。 我试过: androidmanifest.xml <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> //window.plugins.socialsharing.share“共享文本”; } 并将文件SocialSharing.java复制到project_目录\src\nl\xservices\plugins中 logcat告诉我

我建立我的应用程序,所以需要使用社交共享。。。 我试过:

androidmanifest.xml

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
//window.plugins.socialsharing.share“共享文本”; }

并将文件SocialSharing.java复制到project_目录\src\nl\xservices\plugins中

logcat告诉我:

04-06 17:11:35.953  20095-20095/com.emaarit.app.sample V/webview﹕ singleCursorHandlerTouchEvent -getEditableSupport  FASLE
04-06 17:11:36.265  20095-20095/com.emaarit.app.sample D/CordovaLog﹕ file:///android_asset/www/index.html: Line 30 : Index.html >> Sharing ...
04-06 17:11:36.265  20095-20095/com.emaarit.app.sample I/Web Console﹕ Index.html >> Sharing ... at file:///android_asset/www/index.html:30
04-06 17:11:36.265  20095-20095/com.emaarit.app.sample D/CordovaLog﹕ file:///android_asset/www/index.html: Line 31 : Uncaught TypeError: Cannot read property 'socialsharing' of undefined
04-06 17:11:36.273  20095-20095/com.emaarit.app.sample E/Web Console﹕ Uncaught TypeError: Cannot read property 'socialsharing' of undefined at file:///android_asset/www/index.html:31
当我想安装插件时,以管理员身份运行“node.js命令提示符”Windows 7并键入以下命令:

npm install -d cordova plugin add https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git
它向我显示了错误:

npm info it worked if it ends with ok
npm info using npm@1.4.23
npm info using node@v0.10.31
npm info retry fetch attempt 1 at 16:15:35
npm http GET https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git

npm info trying registry request attempt 1 at 16:15:35
npm http GET https://registry.npmjs.org/plugin
npm info trying registry request attempt 1 at 16:15:35
npm http GET https://registry.npmjs.org/cordova
npm info trying registry request attempt 1 at 16:15:35
npm http GET https://registry.npmjs.org/add
npm http 304 https://registry.npmjs.org/cordova
npm http 304 https://registry.npmjs.org/add
npm http 304 https://registry.npmjs.org/plugin
npm http 200 https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git

npm ERR! not a package C:\Users\USER7~1.EMI\AppData\Local\Temp\npm-1140-PenpyXjc
\github.com\EddyVerbruggen\SocialSharing-PhoneGap-Plugin.git
npm ERR! Error: ENOENT, open 'C:\Users\USER7~1.EMI\AppData\Local\Temp\npm-1140-P
enpyXjc\github.com\EddyVerbruggen\SocialSharing-PhoneGap-Plugin.git-unpack\packa
ge.json'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-d" "cordova" "plugin" "add"
 "https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git"
npm ERR! cwd C:\Users\user7.EMIT
npm ERR! node -v v0.10.31
npm ERR! npm -v 1.4.23
npm ERR! path C:\Users\USER7~1.EMI\AppData\Local\Temp\npm-1140-PenpyXjc\github.c
om\EddyVerbruggen\SocialSharing-PhoneGap-Plugin.git-unpack\package.json
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\user7.EMIT\npm-debug.log
npm ERR! not ok code 0

如何解决此问题?

现在您正在使用window.plugins.socialsharing调用插件。我很好奇调用window.socialsharing是否有效?错误:Egain,当按住ctrl键并单击“socialsharing”时,不要打开此文件04-06 17:41:43.757 22253-22253/com.emaarit.app.sample D/CordovaLog﹕ file:///android_asset/www/index.html: 第31行:未捕获类型错误:无法调用未定义04-06 17:41:43.757 22253-22253/com.emaarit.app.sample E/Web控制台的方法“share”﹕ 未捕获的TypeError:无法在处调用未定义的方法“share”file:///android_asset/www/index.html:31In 关于节点错误,pluginadd是一个cordova命令。您只需将其作为cordova插件添加运行即可https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git. 正确安装此插件,然后查看插件是否仍然未定义。命令cordova plugin add not working,因为node.js显示:当前工作目录不是基于cordova的项目。然后转到您的cordova项目文件夹
04-06 17:11:35.953  20095-20095/com.emaarit.app.sample V/webview﹕ singleCursorHandlerTouchEvent -getEditableSupport  FASLE
04-06 17:11:36.265  20095-20095/com.emaarit.app.sample D/CordovaLog﹕ file:///android_asset/www/index.html: Line 30 : Index.html >> Sharing ...
04-06 17:11:36.265  20095-20095/com.emaarit.app.sample I/Web Console﹕ Index.html >> Sharing ... at file:///android_asset/www/index.html:30
04-06 17:11:36.265  20095-20095/com.emaarit.app.sample D/CordovaLog﹕ file:///android_asset/www/index.html: Line 31 : Uncaught TypeError: Cannot read property 'socialsharing' of undefined
04-06 17:11:36.273  20095-20095/com.emaarit.app.sample E/Web Console﹕ Uncaught TypeError: Cannot read property 'socialsharing' of undefined at file:///android_asset/www/index.html:31
npm install -d cordova plugin add https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git
npm info it worked if it ends with ok
npm info using npm@1.4.23
npm info using node@v0.10.31
npm info retry fetch attempt 1 at 16:15:35
npm http GET https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git

npm info trying registry request attempt 1 at 16:15:35
npm http GET https://registry.npmjs.org/plugin
npm info trying registry request attempt 1 at 16:15:35
npm http GET https://registry.npmjs.org/cordova
npm info trying registry request attempt 1 at 16:15:35
npm http GET https://registry.npmjs.org/add
npm http 304 https://registry.npmjs.org/cordova
npm http 304 https://registry.npmjs.org/add
npm http 304 https://registry.npmjs.org/plugin
npm http 200 https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git

npm ERR! not a package C:\Users\USER7~1.EMI\AppData\Local\Temp\npm-1140-PenpyXjc
\github.com\EddyVerbruggen\SocialSharing-PhoneGap-Plugin.git
npm ERR! Error: ENOENT, open 'C:\Users\USER7~1.EMI\AppData\Local\Temp\npm-1140-P
enpyXjc\github.com\EddyVerbruggen\SocialSharing-PhoneGap-Plugin.git-unpack\packa
ge.json'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-d" "cordova" "plugin" "add"
 "https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git"
npm ERR! cwd C:\Users\user7.EMIT
npm ERR! node -v v0.10.31
npm ERR! npm -v 1.4.23
npm ERR! path C:\Users\USER7~1.EMI\AppData\Local\Temp\npm-1140-PenpyXjc\github.c
om\EddyVerbruggen\SocialSharing-PhoneGap-Plugin.git-unpack\package.json
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\user7.EMIT\npm-debug.log
npm ERR! not ok code 0