Detect if iOS app is running on Apple Silicon Mac using pure C

Is there a way in pure C (not Objective-C, and certainly not Swift) way to detect if an iOS app is running on a Mac? I'm aware of iOSAppOnMac, but AFAICT I'd need to write Objective-C code to use it. My application is quite old and large, with portions going back to the 1980s, so the burden of moving on the anything that can't be accessible directly from C is quite high.

  • Sorry, dude, get with the times. If it's not published or public, it's private, and there'd be no info available on what you're asking.

Add a Comment

Replies

You should use iOSAppOnMac for this.

Given that there’s no way to create an iOS app without using some Objective-C, your build system must be able to handle that somehow. If you need to access to this value in a part of your app where calling Objective-C is inconvenient, create your own abstraction for it. That is, write some Objective-C code that exports a C function that your C code can call. Or even use a global variable, as this isn’t going to change during the lifetime of your process.

Share and Enjoy

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

  • Thanks, Quinn. This is slightly annoying--I want this in the (nearly) platform-independent computational engine, which we build as a framework for iOS, while the Objective-C is in the GUI application that loads the framework. (The former has moved from MacOS -> MacOSX + iOS and from m68k->PPC->PPC64->x86->x86_64->arm64 with only minor tweaks, while the latter has needed major rewrites to go from MacOS -> Carbon -> Cocoa (AppKit) and a separate rewrite to go to UIKit.) But I'll live...

Add a Comment