How do you get an iPhone's device name

前端 未结 9 1588
我在风中等你
我在风中等你 2020-11-29 22:26

If you open Settings -> General -> About, it\'ll say Bob\'s iPhone at the top of the screen. How do you programmatically grab that name?

9条回答
  •  自闭症患者
    2020-11-29 23:28

    Remember: import UIKit

    Swift:

    UIDevice.currentDevice().name
    

    Swift 3, 4, 5:

    UIDevice.current.name
    

提交回复
热议问题