IOS 최신 가져오기 설정 이름

3736 단어
기존 방법에서는 ios7을 Write Extension UIDevice 로 바꾸는 것을 지원하지 않습니다. {var modelName: String {
    var systemInfo = utsname()
    uname(&systemInfo)
    var identifier = NSString(bytes: &systemInfo.machine, length: Int(_SYS_NAMELEN), encoding: NSUTF8StringEncoding)! as String// n \0

    func seach(str:String)->Bool{
        if identifier.rangeOfString(str) != nil{
            return true
        }
        return false
    }

    
    switch true {
    
    
    case seach("iPhone8,4"):                                                return "iPhone SE"
    case seach("iPhone4,1"):                                                return "iPhone 4s"
    case seach("iPhone5,1"), seach("iPhone5,2"):                            return "iPhone 5"
    case seach("iPhone5,3"), seach("iPhone5,4"):                            return "iPhone 5c"
    case seach("iPhone6,1"), seach("iPhone6,2"):                            return "iPhone 5s"
    case seach("iPhone7,2"):                                                return "iPhone 6"
    case seach("iPhone7,1"):                                                return "iPhone 6 Plus"
    case seach("iPhone8,1"):                                                return "iPhone 6s"
    case seach("iPhone8,2"):                                                return "iPhone 6s Plus"
    case seach("iPad2,1"), seach("iPad2,2"), seach("iPad2,3"), seach("iPad2,4")   :return "iPad 2"
    case seach("iPad3,1"), seach("iPad3,2"), seach("iPad3,3"):              return "iPad 3"
    case seach("iPad3,4"), seach("iPad3,5"), seach("iPad3,6"):              return "iPad 4"
    case seach("iPad4,1"), seach("iPad4,2"), seach("iPad4,3"):              return "iPad Air"
    case seach("iPad5,3"), seach("iPad5,4"):                                return "iPad Air 2"
    case seach("iPad2,5"), seach("iPad2,6"), seach("iPad2,7"):              return "iPad Mini"
    case seach("iPad4,4"), seach("iPad4,5"), seach("iPad4,6"):              return "iPad Mini 2"
    case seach("iPad4,7"), seach("iPad4,8"), seach("iPad4,9"):              return "iPad Mini 3"
    case seach("iPad5,1"), seach("iPad5,2"):                                return "iPad Mini 4"
    case seach("iPad6,7"), seach("iPad6,8"):                                return "iPad Pro"
    case seach("iPad6,4"), seach("iPad6,3"):                                return "iPad Pro(9.7)"
    case seach("iPhone3,1") ,seach("iPhone3,2") ,seach("iPhone3,3"):        return "iPhone 4"
    case seach("iPod5,1"):                                                  return "iPod Touch 5"
    case seach("iPod7,1"):                                                  return "iPod Touch 6"
    case seach("AppleTV5,3"):                                               return "Apple TV"
    case seach("i386"), seach("x86_64"):                                    return "Simulator"

        //  
    case seach("iPod") :   return "iPod"
    case seach("iPad"):   return "iPad"
    case seach("iPhone"): return "iPhone"
    default:
        return "iPhone"
    }
    
    
}

}

좋은 웹페이지 즐겨찾기