我正在使用自定义键盘,如果我在课堂上包含此代码,则会出现错误:
let isPad = UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad
Error - Command/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
我需要这段代码,因为当用户在 iPad 上运行 iPhone 应用程序(如 instagram)时,我需要加载 iPhone 键盘预设并使用它的几何图形。我尝试了以下代码,但这不是解决方案:
如果 UI_USER_INTERFACE_IDIOM() == .Pad {
}
所以如果有人有任何解决方案,请分享。