appID对了 , key也对了,为什么就是分享不成功呢,我日!
找了2天,发现,尼玛,原来CCApp.java里面也有做设置平台信息的配置, 原来这里的appID appkey 不对。 改了这里,就分享成功了。日。
public class CCApp extends Application{ { PlatformConfig.setWeixin("wx4111c4b9d895d423","20d56bf6cf8a11a40f4adafa6929f484"); PlatformConfig.setSinaWeibo("3921700954","04b48b094faeb16683c32669824ebdad"); PlatformConfig.setYixin("yxc0614e80c9304c11b0391514d09f13bf"); PlatformConfig.setLaiwang("laiwangd497e70d4","d497e70d4c3e4efeab1381476bac4c5e"); PlatformConfig.setQQZone("100424461","c7394704798a158208a74ab30104f0ba"); PlatformConfig.setTwitter("3aIN7fuF685MuZ7jtXkQxalyi","MK6FEYG63eWcpdfgRYw4w9puJhzDl0tyuqWjZ3M7XJuuG7mMbO"); }}
#include "stdafx.h"#include "LuaMgr.h"#include "CustomNode.h"#include "LuaCsbLoader.h"#include "Cocos2dx/Common/CCUMSocialSDK.h"#include "Cocos2dx/Sharebutton/UMSharebutton.h"#include "LuaUMengShare.h"USING_NS_CC;// ʹ???????????ռ?USING_NS_UM_SOCIAL;#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)/* * ?????ص?,?ûص?????ij?????ij?Ա?????? ????һ????ͨ?ĺ???,????ʹ?òο?HelloWorldScene??????* @param platform Ҫ????????Ŀ??ƽ̨ * @param stCode ??????,200?????????ɹ?,100??????ʼ???? * @param errorMsg ????ʧ??ʱ?Ĵ?????Ϣ,androIDƽ̨û?д?????Ϣ */voID shareCallback(int platform,int stCode,string& errorMsg){ if ( stCode == 100 ) { XLOG("####111111111111111111111111111111111111111 ??ʼ???? %d.",stCode); } else if ( stCode == 200 ) { XLOG("####2222222222222222222222222222222222222222 ?????ɹ? %d.",stCode); } else { XLOG("####333333333333333333333333333333333333333333 ???????? %d.",stCode); } XLOG("############################################platform num is : %d.",platform);}IMPL_LUA_CLASS_BEGIN(LuaUMengShare) EXPORT_LUA_FUNCTION(LuaAddUMengShare)IMPL_LUA_CLASS_END()int LuaUMengShare::LuaAddUMengShare(lua_State* L){ //const char* url = luaL_checkstring(L,1); if (init()) return 0; else return 1;}bool LuaUMengShare::init(){ if ( !cclayer::init() ) { return false; } // ??????????ť,????1Ϊ??ť?????????µ?ͼƬ,????2Ϊ??ťѡ??ʱ??ͼƬ,????3Ϊ????appkey,????4Ϊ?????ص? UMSharebutton *sharebutton = UMSharebutton::create("img/mole/weixin.png","img/mole/weixin.png","56f8da28e0f************e3",share_selector(shareCallback)); // ??ʾ?????˷????????ϵ?ƽ̨ vector<int>* platforms = new vector<int>();// platforms->push_back(SINA);// platforms->push_back(RENREN);// platforms->push_back(DOUBAN); platforms->push_back(QZONE); platforms->push_back(QQ); platforms->push_back(WEIXIN); platforms->push_back(WEIXIN_CIRCLE); // ???????˷???????????ʾ??ƽ̨ sharebutton->setPlatforms(platforms); // ?????ı????????? sharebutton->setShareContent("umeng social cocos2d-x sdk.") ; // ????Ҫ??????ͼƬ,ͼƬ֧?ֱ???ͼƬ??urlͼƬ,????urlͼƬ??????http://????https://??ͷ //sharebutton->setShareImage("img/mole/weixin.png") ; // ???ð?ť??λ?? sharebutton->setposition(ccp(150,180));
Ccmenu* pMenu = Ccmenu::create(sharebutton,NulL); pMenu->setposition(CCPointZero); this->addChild(pMenu,1); // ********************** ????ƽ̨??Ϣ *************************** CCUMSocialSDK *sdk = sharebutton->getSocialSDK(); sdk->setQQAppIDAndAppKey("11052*6505","ErGT3*VLqxgaOjQ3"); sdk->setWeiXinAppInfo("wx4111c4b9****5d429","20d56bf*****a11a40f4adafa6929f482"); // ?????û?????һ??ͼ?ķ???ʱ?û???ת????Ŀ??ҳ??,һ??Ϊapp??ҳ????????ҳ?? // -- 注意, 这个文件要用utf-8的格式打开哦,否则中文分享会乱码,甚至导致游戏闪退! sdk->setPlatformShareContent(QQ,"换实物奖品哦~~","http://c.csdnimg.cn/www/images/ali.png","无聊?吧~","http://www.cocos.com/"); sdk->setPlatformShareContent(QZONE,"兑换实物奖品哦~~","https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo/bd_logo1_31bdc765.png","无聊?~","http://www.cocos.com/"); sdk->setPlatformShareContent(WEIXIN,"实物奖品哦~~","http://www.cocos.com/"); sdk->setPlatformShareContent(WEIXIN_CIRCLE,"http://www.cocos.com/"); // ?总结
以上是内存溢出为你收集整理的cocos2dx集成友盟社会化分享全部内容,希望文章能够帮你解决cocos2dx集成友盟社会化分享所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)