调用不可用的功能“系统”:iOS上不可用?

时间:2018-11-06 22:34:11

标签: ios iphone xcode

几年前,我正在重新审视源代码,它曾经可以完美地进行编译,但是现在项目中出现了一个我不知道的错误。

我有以下代码:

void AssetsManager::destroyStoragePath()
{
    // Delete recorded version codes.
    deleteVersion();

    // Remove downloaded files
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM ==     CC_PLATFORM_WP8)
    FileUtils::getInstance()->removeDirectory(_storagePath.c_str());
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
    string command = "rd /s /q ";
    // Path may include space.
    command += "\"" + _storagePath + "\"";
    system(command.c_str());
#else
    string command = "rm -r ";
    // Path may include space.
    command += "\"" + _storagePath + "\"";
    system(command.c_str());
#endif
}

NS_CC_EXT_END;`

我收到以下错误:

“调用不可用功能'system':在iOS上不可用”

如何解决此错误?

1 个答案:

答案 0 :(得分:0)

除系统外,还有几种方法。您可以使用NSTask(快速处理)