正在与OS 10.12及更低版本一起使用但在10.13中面临兼容性问题的应用程序上工作
Xcode 7.3.1(与Xcode 8.3.1相同的错误)
因此,该应用程序倾向于在main.mm中的return NSApplicationMain(argc,argv)
处使用EXC_BAD_ACCESS崩溃。
代码:
int main(int argc, const char * argv[])
{
bool bIsChild;
ApplicationContext::GetInstance()->parseCommandLineArgs(argc, (char **)argv, bIsChild);
if(!ApplicationContext::GetInstance()->isTestWorkflow)
{
if(!bIsChild)
{
ApplicationContext::GetInstance()->_bAnotherInstanceRunning = !ApplicationContext::GetInstance()->acquireADMLock();
[NSApplication sharedApplication];
}
if(!ApplicationContext::GetInstance()->_bAnotherInstanceRunning)
{
ApplicationContext::GetInstance()->initGlobalLogger(!bIsChild);
bool bRet = ApplicationContext::GetInstance()->elevationManager->initElevationHandler();
if(!bRet)
{
//TODO : proper error handling required...
ApplicationContext::GetInstance()->currLogger.fatal("Quitting", "Unable to initialize Elevation Manager. Quitting...");
return 0;
}
if(bIsChild)
{
ApplicationContext::GetInstance()->elevationManager->waitForFinish();
return 0;
}
}
}
return NSApplicationMain(argc, argv);
}