swift 判断真机还是模拟器

 if Platform.isSimulator {
            // Do one thing
            print("isSimulator")
        }
        else {

        }
 
 
 
struct Platform {
    static let isSimulator: Bool = {
        var isSim = false
        #if arch(i386) || arch(x86_64)
            isSim = true
        #endif
        return isSim
    }()
}

 

posted on 2018-02-01 13:39  JieFangZhe  阅读(477)  评论(0编辑  收藏  举报

导航