2

我不明白为什么 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);

应用程序编译成功,但该代码抛出一个消息框,显示“ProviderNotFoundException”。

在 AppDelegate.cpp 中,这是我从 applicationDidFinishLaunching 执行的初始化:

#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);

你能帮我进一步了解个人资料吗?

4

2 回答 2

1

这不是答案,但您也许可以从这里收集到一些东西:http: //answers.soom.la/t/resolved-twitter-providernotfoundexception/675/6

在这里:http ://answers.soom.la/t/resolved-exception-with-cocos2d-x-profile/1572

于 2015-04-18T18:17:01.673 回答
0

据我了解,他们使用反射来加载提供程序( https://github.com/soomla/ios-profile/blob/9e887f07e0d7f1acb680e02c593a8ce485c93252/SoomlaiOSProfile/ProviderLoader.m#L43)。也许那些分类的只是还没有加载。

您可以尝试使用“-ObjC”链接器标志或类似的东西。

于 2015-04-21T15:36:35.533 回答