有没有办法在运行时在MAC上找到流程架构?
我使用sizeof(int) == 4
表示32位,sizeof(int) == 8
表示64位。有优雅的方式吗?
答案 0 :(得分:0)
使用@property(readonly) NSInteger executableArchitecture
和NSBundle
Mach-O Architecture
NSInteger architecture = [[NSRunningApplication currentApplication] executableArchitecture];
if(architecture == NSBundleExecutableArchitectureX86_64) {
NSLog(@"running on 64bits");
else if (architecture == NSBundleExecutableArchitectureI386) {
NSLog(@"running on 32bits");
} else {
NSLog(@"running somewhere else");
}