2015-04-18 21 views
2

我不明白为什么配置文件总是返回错误:“ProviderNotFoundException”。我遵循预编译的集成指令,我在github上为soomla-cocos2dx-core,cocos2dx-profile和cocos2dx-store使用最新版本。soomla:cocos2dx:Profile - >“ProviderNotFoundException”(cocos2d3.x)

这里是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在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

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

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

+0

不幸的是,我已经在项目中使用了-ObjC。看起来Profile与预编译的ios-profile“.a”文件捆绑在一起。也许这些文件不喜欢与cocos2dx部分一起使用(其中的某些内容不是最新的)? – Zenslainer

+0

您可以尝试为项目使用“sourced”版本(请参阅https://github.com/soomla/cocos2dx-profile#working-with-sources) – vedi

相关问题