cuốn sách gpt4 ai đã làm

iphone - Cocoa touch - Lấy thông tin thiết bị

In lại Tác giả: Taklimakan Thời gian cập nhật: 2023-11-02 09:00:05 29 4
mua khóa gpt4 Nike

Tôi thực hiện tác vụ này để đọc một số thông tin thiết bị như tên thiết bị, loại, dung lượng ổ đĩa và phiên bản iOS. Tôi có một số cách để biết thiết bị đó là iPad, iPhone hay Retina, nhưng tôi không biết thêm gì về thiết bị đó.

câu trả lời hay nhất

Đọc phiên bản iOS:

NSString* iOSVersion = [[UIDevice currentDevice] systemVersion];

Đọc các mẫu iPad:

BOOL isIPad2 = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad &&
[UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]);
NSString* iPadModel = [mô hình [UIDevice currentDevice]];
nếu (isIPad2)
iPadModel = @"iPad2";

Đọc dung lượng đĩa trống/tổng ​​cộng:

- (NSNumber *) tổngDiskSpace
{
NSDictionary *fattributes = [[NSFileManager defaultManager] attributeOfFileSystemForPath:NSHomeDirectory() error:nil];
trả về [fattributes objectForKey:NSFileSystemSize];
}

- (NSNumber*) freeDiskSpace
{
NSDictionary *fattributes = [[NSFileManager defaultManager] attributeOfFileSystemForPath:NSHomeDirectory() error:nil];
trả về [fattributes objectForKey:NSFileSystemFreeSize];
}

Về iphone - Cocoa touch - lấy thông tin thiết bị, chúng tôi tìm thấy một câu hỏi tương tự trên Stack Overflow: https://stackoverflow.com/questions/8242469/

29 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress