我在这里找到了这段代码:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
str = [NSString stringWithString:@"Running as an iPad application"];
} else {
str = [NSString stringWithString:
@"Running as an iPhone/iPod touch application"];
}
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Platform"
message:str
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
这种检查有多安全?苹果真的推荐这样做吗?或者它会不会将 iPad 检测为 iPad,或将 iPhone 检测为 iPhone?