Is it possible to execute machine code on iOS with permission

When Xcode is connected to the mobile phone for debugging, the app that contains the logic of executing machine code runs normally, but if Xcode is disconnected and the app is run alone, it will crash.

  1. First use the xcode-run execution function to start the app

  2. The machine code logic executes normally

  3. Disconnect the phone from xcode

  4. Start the app

5.Crash

Here is the test code:https://gitee.com/FanChiang_admin/demo.git

Looking at your test project, it’s clear that your goal is to generate code on the fly. That’s not supported on iOS [1]. All the executable code must come from an appropriate signed Mach-O image that’s either part of your app or part of the system.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] There’s one exception to this, namely web browsers. Safari and third-party browsers can use JIT, but with some significant restrictions. See Protecting code compiled just in time.

Note that this requires authorisation to use the com.apple.developer.cs.allow-jit entitlement. This is a managed entitlement, that is, Apple must approve your use of it. AFAIK that approval is only granted to browser developers.

Oh, don’t confused com.apple.developer.cs.allow-jit with com.apple.security.cs.allow-jit. The latter is for the macOS hardened runtime, and any developer can use it on macOS.

Is it possible to execute machine code on iOS with permission
 
 
Q