【发布时间】:2015-08-11 04:43:38
【问题描述】:
我想通过 React Native 访问设备名称(来自 UIDevice)。有什么好办法吗?
【问题讨论】:
-
我知道它可以从 UIDevice 访问,我想知道是否有 React Native 库或暴露 UIDevice 的方法。
-
NSLog(@"uniqueIdentifier: %@", [[UIDevice currentDevice] uniqueIdentifier]); NSLog(@"name: %@", [[UIDevice currentDevice] name]); NSLog(@"systemName: %@", [[UIDevice currentDevice] systemName]); NSLog(@"systemVersion: %@", [[UIDevice currentDevice] systemVersion]); NSLog(@"model: %@", [[UIDevice currentDevice] model]); NSLog(@"localizedModel: %@", [[UIDevice currentDevice]localizedModel]);
-
您的评论没有帮助,因为它忽略了问题的 React Native 部分。
-
这是一个提供设备信息的组件,您可以扩展它github.com/GertjanReynaert/react-native-device 或构建您自己的一个原生组件
标签: ios react-native