Call to unavailable function 'system': not available on iOS

北战南征 提交于 2019-12-23 13:08:34

问题


I'm new to cocos2d-x and while compiling my project I get this error.

Call to unavailable function 'system': not available on iOS

I see this call is no longer applicable but, what can I use to replace it? Any insight would be appreciated!

bool FileUtils::removeDirectory(const std::string& path)
{
#if !defined(CC_TARGET_OS_TVOS)
    std::string command = "rm -r ";
    // Path may include space.
    command += "\"" + path + "\"";
    if (system(command.c_str()) >= 0) /*System Call Error/Not Availible*/
        return true;
    else
        return false;
 #else
    return false;
#endif
}

回答1:


system function is not available on iOS 11, there is a accepted PR for the same issue.

Now we're using nftw instead of system. Update your source with v3 branch of cocos2d-x repo.




回答2:


system function is not available on iOS 11 Use this mean while until Oct 9 we can have new cocos2d-x 3.16

if (command.size() >= 0)



来源:https://stackoverflow.com/questions/45420717/call-to-unavailable-function-system-not-available-on-ios

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!