獲取iOS程式之執行環境是iphone或ipad

2021-06-10 10:24:39 字數 1465 閱讀 8075

可以從 uidevice 的屬性 model 得到在現在執行的環境。例子如下:

更新了一下,支援iphone4和ipad,ipod touch4

#import

#import

enum ;

@inte***ce devicedetection : nsobject

+ (uint) detectdevice;

+ (int) detectmodel;

+ (nsstring *) returndevicename:(bool)ignoresimulator;

+ (bool) isipodtouch;

+ (bool) isos4;

+ (bool) cansendsms;

@end

#import "devicedetection.h"

#import

#include

#include

@implementation devicedetection

+ (bool) isipodtouch

else

}+ (bool) isos4

+ (bool)cansendsms

+ (nsstring *)platform

+ (int) detectmodel

+ (uint) detectdevice

else if ([model compare:ipad] == nsorderedsame) else if ([model compare:ipodtouch] == nsorderedsame) else if ([model compare:ipodtouchlowercase] == nsorderedsame) else if ([model compare:ipodtouchshort] == nsorderedsame) else else if (!strcmp(u.machine, "iphone1,2")) else if (!strcmp(u.machine, "iphone2,1")) else if (!strcmp(u.machine, "iphone3,1"))

}return detected;

}+ (nsstring *) returndevicename:(bool)ignoresimulator else

break;

case model_ipod_touch:

returnvalue = @"ipod touch";

break;

case model_iphone:

returnvalue = @"iphone";

break;

case model_iphone_3g:

returnvalue = @"iphone 3g";

break;

default:

break;

}return returnvalue;

}@end

程式是在何種環境中執行的

問題 應用的執行環境,指的是什麼?作業系統 硬體 macintosh用的作業系統macos,在at相容機上能執行嗎?無法執行,不同的硬體種類需要不同的作業系統 windows上的應用,在macos上能執行嗎?無法執行,應用是為了在特定作業系統上執行而作成的 freebsd提供的ports,指的是什麼...

原創 判斷程式的執行環境是VM收藏

原創 判斷程式的執行環境是vm收藏 老v的 很古老的 抗vm分析 mov ecx,0ah cx function 0ah get version mov eax,vmxh eax magic mov dx,vx dx magic in eax,dx specially processed io cm...

程式是怎樣執行的

程式儲存在磁碟上,程式執行在記憶體中,我們雙擊執行乙個程式的時候,作業系統通過檔案管理器找到檔案資料儲存的具體位置 通過磁碟定址技術 然後將程式載入到記憶體 每個程序對應乙個虛擬記憶體,就相當於每個程序獨自占有主記憶體,每個程序看到的記憶體位址都是一樣的,稱為虛擬位址空間 程式不會全部載入到記憶體,...