以下代码是WWDC中的中级
Swift谈话示例的派生.我要做的是从一个键属性列表初始化一个模型类,它来自某种API.
class Movie { var title: String init(title: String) { self.title = title } } func movieFromDictionary(dict: Dictionary<String,AnyObject>) -> Movie? { switch dict["title"] { case .some(let movieTitle as String): return Movie(title: movieTitle) default: return nil } }
当我尝试编译这些时,我收到以下错误:
Bitcast requires both operands to be pointer or neither %38 = bitcast i8* %37 to %sS,!dbg !161 Invalid operand types for ICmp instruction %39 = icmp ne %sS %38,null,!dbg !161 PHI nodes must have at least one entry. If the block is dead,the PHI should be removed! %42 = phi i64,!dbg !161 PHI node operands are not the same type as the result! %41 = phi i8* [ %38,%34 ],!dbg !161 LLVM ERROR: broken function found,compilation aborted! Command /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift Failed with exit code 1
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。