Note that there are some explanatory texts on larger screens.

plurals
  1. POEXC_BAD_ACCESS upon accessing a static member?
    primarykey
    data
    text
    <p>I've developed a game on Cocos2d-x v2 platform I started on Android, after completely finishing the coding on Eclipse I used the same code on Xcode to create and iOS version. After adding all the required libraries, I succeeded in compiling the code. However, the game hangs the moment it runs on an iOS device, although it runs without any problem on Android. I tried both the emulator and an iPod, but I always get an EXC_BAD_ACCESS when accessing a static member from a static method. The static member would always point to 0x0!! Here's an excerpt from the code:\</p> <p>AppDelegate.cpp</p> <pre><code>#include "AppDelegate.h" #include "NASEncData.h" AppDelegate::AppDelegate() { ep = NASEncData::sharedUserData(); } </code></pre> <p>NASEncData.h</p> <pre><code>namespace CocosNas { class NASEncData : public CCObject { public: static NASEncData* sharedUserData(); private: NASEncData(); static void initXMLFilePath(); static std::string m_sFilePath; } } </code></pre> <p>NASEncData.cpp</p> <pre><code>#include "NASEncData.h" NASEncData* NASEncData::sharedUserData() { initXMLFilePath(); // only create xml file one time // the file exists after the programe exit if ((! isXMLFileExist()) &amp;&amp; (! createXMLFile())) { return NULL; } if (! m_spUserData) { m_spUserData = new NASEncData(); } return m_spUserData; } void NASEncData::initXMLFilePath() { if (! m_sbIsFilePathInitialized) { m_sFilePath += CCFileUtils::sharedFileUtils()-&gt;getWriteablePath() + NASENCDATA_XML_FILE_NAME; &lt;----error happens here m_sbIsFilePathInitialized = true; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload