解决2.4.x ios 真机闪退问题

由于 jit 不支持ios ,引擎错误开启支持导致。修改 \cocos2d-x\cocos\scripting\js-bindings\jswrapper\v8\ScriptEngine.cpp 该路径下方法jitSupported


bool jitSupported() {
            #if CC_IOS_FORCE_DISABLE_JIT
            return false;
            #elif TARGET_CPU_X86 || TARGET_CPU_X86_64
            return true;
            #else
            
            //2022.7.1 暂时移除其他版本jit支持,解决真机闪退问题
//            // Check for arm64e.
//            cpu_type_t cpuType = 0;
//            size_t cpuTypeSize = sizeof(cpu_type_t);
//            if (::sysctlbyname("hw.cputype", &cpuType, &cpuTypeSize, nullptr, 0) < 0) {
//                SE_LOGD("Could not execute sysctl() to get CPU type: %s", strerror(errno));
//            }
//
//            cpu_subtype_t cpuSubType = 0;
//            if (::sysctlbyname("hw.cpusubtype", &cpuSubType, &cpuTypeSize, nullptr, 0) < 0) {
//                SE_LOGD("Could not execute sysctl() to get CPU subtype: %s", strerror(errno));
//            }
//
//            // Tracing is necessary unless the device is arm64e (A12 chip or higher).
//            if (cpuType != CPU_TYPE_ARM64 || cpuSubType != CPU_SUBTYPE_ARM64E) {
//                return false;
//            }
//
//            // Check for iOS 14.2 and higher.
//            size_t osVersionSize;
//            ::sysctlbyname("kern.osversion", NULL, &osVersionSize, NULL, 0);
//            char osversionBuffer[osVersionSize];
//
//            if (::sysctlbyname("kern.osversion", osversionBuffer, &osVersionSize, NULL, 0) < 0) {
//                SE_LOGD("Could not execute sysctl() to get current OS version: %s", strerror(errno));
//                return false;
//            }
//
//            int majorVersion = 0;
//            char minorLetter = 'Z';
//
//            for (size_t index = 0; index < osVersionSize; index++) {
//                char version_char = osversionBuffer[index];
//                // Find the minor version build letter.
//                if (isalpha(version_char)) {
//                    majorVersion = atoi((const char*)osversionBuffer);
//                    minorLetter = toupper(version_char);
//                    break;
//                }
//            }
//            // 18B92 is iOS 14.2 beta release candidate where tracing became unnecessary.
//            return majorVersion > 18 || (majorVersion == 18 && minorLetter >= 'B');
            return false;
            #endif //TARGET_CPU_X86 || TARGET_CPU_X86_64
        }
                

This article was updated on 九月 23, 2022