Skip to content

Commit ef5e962

Browse files
Merge pull request #416 from CelloSerenity/main
Fix TXM detection on iOS 27
1 parent c504ef3 commit ef5e962

2 files changed

Lines changed: 28 additions & 33 deletions

File tree

.github/workflows/build_ipa.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919

2020
steps:
2121
- name: 1. Fetch Source Code
22-
uses: actions/checkout@v4
22+
uses: actions/checkout@v6
2323

2424
- name: 2. Configure Xcode Environment
2525
uses: maxim-lobanov/setup-xcode@v1

StikDebug/Support/ProcessInfo+TXM.swift

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,45 @@
66
import Foundation
77

88
public extension ProcessInfo {
9-
var hasTXMClassic: Bool {
10-
ProcessInfo.processInfo.isiOSAppOnMac ? false : ProcessInfo.detectLocalTXM()
11-
}
12-
139
var hasTXM: Bool {
1410
if isTXMOverridden {
1511
return true
1612
}
1713

18-
return ProcessInfo.hasTXMSupport(
19-
isIOS266OrNewer: ProcessInfo.isIOS266OrNewer,
20-
hasTXMClassic: hasTXMClassic,
21-
hardwareIdentifier: hardwareIdentifier()
22-
)
14+
let hardware = hardwareIdentifier()
15+
16+
if ProcessInfo.isIOS27OrNewer {
17+
return hardware != "iPad8,11" && hardware != "iPad8,12"
18+
}
19+
20+
if ProcessInfo.isIOS26OrNewer {
21+
return ProcessInfo.hasTXMSupport(
22+
hardwareIdentifier: hardware
23+
)
24+
}
25+
26+
return false
2327
}
2428

2529
var isTXMOverridden: Bool {
2630
UserDefaults.standard.bool(forKey: UserDefaults.Keys.txmOverride)
2731
}
2832

2933
internal static func hasTXMSupport(
30-
isIOS266OrNewer: Bool,
31-
hasTXMClassic: Bool,
3234
hardwareIdentifier: String
3335
) -> Bool {
34-
if isIOS266OrNewer, !hasTXMClassic {
35-
let firstTXM = 14.2
36-
let iPadTXM = 14.5
37-
38-
if let ver = ProcessInfo.processInfo.deviceVersion(from: hardwareIdentifier) {
39-
if hardwareIdentifier.hasPrefix("iPad") {
40-
return ver >= iPadTXM
41-
} else {
42-
return ver >= firstTXM
43-
}
44-
}
36+
let firstTXM = 14.2
37+
let iPadTXM = 14.5
4538

39+
guard let ver = ProcessInfo.processInfo.deviceVersion(from: hardwareIdentifier) else {
4640
return false
4741
}
4842

49-
return hasTXMClassic
43+
if hardwareIdentifier.hasPrefix("iPad") {
44+
return ver >= iPadTXM
45+
}
46+
47+
return ver >= firstTXM
5048
}
5149

5250
func deviceVersion(from identifier: String) -> Double? {
@@ -74,19 +72,16 @@ public extension ProcessInfo {
7472
return extractVersion(iPhonePattern) ?? extractVersion(iPadPattern)
7573
}
7674

77-
private static func detectLocalTXM() -> Bool {
78-
if let boot = FileManager.default.filePath(atPath: "/System/Volumes/Preboot", withLength: 36),
79-
let file = FileManager.default.filePath(atPath: "\(boot)/boot", withLength: 96) {
80-
return access("\(file)/usr/standalone/firmware/FUD/Ap,TrustedExecutionMonitor.img4", F_OK) == 0
75+
private static var isIOS26OrNewer: Bool {
76+
if #available(iOS 26.0, *) {
77+
return true
8178
}
8279

83-
return FileManager.default.filePath(atPath: "/private/preboot", withLength: 96).map {
84-
access("\($0)/usr/standalone/firmware/FUD/Ap,TrustedExecutionMonitor.img4", F_OK) == 0
85-
} ?? false
80+
return false
8681
}
8782

88-
private static var isIOS266OrNewer: Bool {
89-
if #available(iOS 26.6, *) {
83+
private static var isIOS27OrNewer: Bool {
84+
if #available(iOS 27.0, *) {
9085
return true
9186
}
9287

0 commit comments

Comments
 (0)