[英]Error: Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
[英]Error — Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1
我正在使用自定义键盘,如果我在我的课程中包含此代码,我收到错误:
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 {
}
如果有人有任何解决方案,请分享。
试试这个:
if UIDevice.currentDevice().userInterfaceIdiom == .Pad {
// iPad Stuff
}
else if UIDevice.currentDevice().userInterfaceIdiom == .Phone {
// iPhone Stuff
}
编辑
斯威夫特3
if UIDevice.current.userInterfaceIdiom == .pad {
// iPad Stuff
}
else if UIDevice.current.userInterfaceIdiom == .phone {
// iPhone Stuff
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.