我必须为特定的设备模型实现一些特殊的行为。所以我需要检查设备模型。
我在用
[UIDevice currentDevice] name];但它会给我这样的回报
Nexus 7 running Apportable我觉得这结果有点奇怪。还有别的办法吗?
发布于 2014-04-14 16:53:20
使用[[UIDevice currentDevice] nativeModel]
NSLog(@"%@", [[UIDevice currentDevice] nativeModel]);将在logcat输出中生成D/Spin ( 3956): 2014-04-14 09:44:21.446 Spin[3956:2752] Nexus 7。
关于UIDevice API扩展在.apportable/SDK/System/UIKit/UIDevice.h中有更多信息。
Apportable通常会为iOS端口尽可能无缝地做出API决策。如果您实际上想要一个Android特定的结果,通常会创建一个非iOS扩展。
下面是关于UIDeve.h映射到Android构建API的一些详细信息
@property (nonatomic, readonly) NSString *nativeSystemName; -> @"Android"
@property (nonatomic, readonly) NSString *nativeCPUABI; -> Build.CPU_ABI
@property (nonatomic, readonly) NSString *nativeModel; -> Build.MODEL
@property (nonatomic, readonly) NSString *nativeProduct; -> Build.PRODUCT
@property (nonatomic, readonly) NSString *nativeManufacturer; -> Build.MANUFACTURER
@property (nonatomic, readonly) NSString *nativeSystemVersion; -> Build.RELEASE
@property (nonatomic, readonly) NSUInteger nativeSDKVersion; -> Build.SDK_INThttps://stackoverflow.com/questions/23064193
复制相似问题