我不明白为什么Profile总是返回错误:“ ProviderNotFoundException ”。我遵循了预先编写的集成指令,我在github上使用了最新版本的soomla-cocos2dx-core,cocos2dx-profile和cocos2dx-store。
以下是使用cocos2dx v3.5完成的示例(3.4上的相同行为):
soomla::CCError *profileError = nullptr;
bool isLoggedIn = soomla::CCSoomlaProfile::getInstance()->isLoggedIn(soomla::TWITTER, &profileError);
if (profileError)
MessageBox(profileError->getInfo(), "Error");
else
CCLOG("logged in TWITTER: %d",isLoggedIn);
应用程序成功编译但该代码抛出一个MessageBox,说“ProviderNotFoundException”。
在AppDelegate.cpp中这是我从applicationDidFinishLaunching做的init:
#define NEWSTRING(s) __String::create(s)
SOOMLA_STORE_EVENTS = new TSoomlaStoreEvents(); // My defined store events
PRODUCTSFORSALE = TItemsForSale::create(); //class for buy items
STOREITEMS = __Dictionary::create();
soomla::CCSoomla::initialize(SOOMLA_CUSTOM_SECRET);//"customSecret");
STOREITEMS->setObject(NEWSTRING(SOOMLA_ANDROID_PUBLIC_KEY), "androidPublicKey");
STOREITEMS->setObject(Bool::create(true), "SSV");
soomla::CCSoomlaStore::initialize(PRODUCTSFORSALE, STOREITEMS);
//----- SOOMLA PROFILE
__Dictionary *profileParams = __Dictionary::create();
__Dictionary *twitterParams = __Dictionary::create();
__Dictionary *googleParams = __Dictionary::create();
twitterParams->setObject(NEWSTRING(SOOMLA_TWITTER_CONSUMER_KEY), "consumerKey");
twitterParams->setObject(NEWSTRING(SOOMLA_TWITTER_CONSUMER_SECRET), "consumerSecret");
googleParams->setObject( NEWSTRING(SOOMLA_GOOGLE_CLIENTID), "clientId");
profileParams->setObject(twitterParams, soomla::CCUserProfileUtils::providerEnumToString(soomla::TWITTER)->getCString());
profileParams->setObject(googleParams, soomla::CCUserProfileUtils::providerEnumToString(soomla::GOOGLE)->getCString());
soomla::CCSoomlaProfile::initialize(profileParams);
你能帮我进一步了解个人资料吗?
答案 0 :(得分:1)
这不是答案,但你可以从这里收集一些东西:http://answers.soom.la/t/resolved-twitter-providernotfoundexception/675/6
在这里:http://answers.soom.la/t/resolved-exception-with-cocos2d-x-profile/1572
答案 1 :(得分:0)
据我了解,他们使用反射来加载提供者( https://github.com/soomla/ios-profile/blob/9e887f07e0d7f1acb680e02c593a8ce485c93252/SoomlaiOSProfile/ProviderLoader.m#L43)。也许那些被归类的人还没有被装上。
您可以尝试使用“-ObjC”链接器标记,或类似的东西。