我刚刚下载了Xcode 6 beta 4,我的swift项目编译没有错误,但在它到达我的代码之前,我得到一个dyld_fatal_error就在调用堆栈的开头.
和带有nop指令的汇编代码中的断点
我得到的控制台错误是
dyld: lazy symbol binding failed: Symbol not found: __TFSsa6C_ARGVGVSs13UnsafePointerGS_VSs4Int8__
Referenced from: /Users/username/Library/Developer/Xcode/DerivedData/Sudoku-dhrdonaeqzsgcvewndimxbbsltnc/Build/Products/Debug/Sudoku.app/Contents/MacOS/Sudoku
Expected in: /Users/username/Library/Developer/Xcode/DerivedData/Sudoku-dhrdonaeqzsgcvewndimxbbsltnc/Build/Products/Debug/Sudoku.app/Contents/MacOS/../Frameworks/libswift_stdlib_core.dylib
dyld: Symbol not found: __TFSsa6C_ARGVGVSs13UnsafePointerGS_VSs4Int8__
Referenced from: /Users/username/Library/Developer/Xcode/DerivedData/Sudoku-dhrdonaeqzsgcvewndimxbbsltnc/Build/Products/Debug/Sudoku.app/Contents/MacOS/Sudoku
Expected in: /Users/username/Library/Developer/Xcode/DerivedData/Sudoku-dhrdonaeqzsgcvewndimxbbsltnc/Build/Products/Debug/Sudoku.app/Contents/MacOS/../Frameworks/libswift_stdlib_core.dylib
Run Code Online (Sandbox Code Playgroud)
只是因为你知道该项目仍在编译,并且在Xcode 6 beta 3中运行良好.
我想用swift做一个虚线.像这样...
var path = NSBezierPath()
path.moveToPoint(NSPoint(x: 1, y: 1))
path.moveToPoint(NSPoint(x: 4, y: 4))
let pattern: ConstUnsafePointer<CGFloat> = {1.0, 1.0} //Not sure how to write this
path.setLineDash(pattern, count: 2, phase: 0.0)
path.stroke()
Run Code Online (Sandbox Code Playgroud)
我的问题是如何制作CGFloats的c数组
我希望能够使用self初始化属性subviewGroup但是这给了我错误:属性'self.gridView'未在super.init调用时初始化
init(frame: NSRect) {
super.init(frame: frame)
subviewGroup = GridViewGroup(rows: 9, columns: 9, gridView: self)
}
/*** Properties ***/
let subviewGroup: GridViewGroup
Run Code Online (Sandbox Code Playgroud)
然后如果我在初始化后把super.init()放到这样的话
init(frame: NSRect) {
subviewGroup = GridViewGroup(rows: 9, columns: 9, gridView: self)
super.init(frame: frame)
}
/*** Properties ***/
let subviewGroup: GridViewGroup
Run Code Online (Sandbox Code Playgroud)
我收到错误:在super.init调用之前使用'self'
我知道我可以使用一个Optional,但是因为在init()调用之后它永远不会是nil似乎没必要.有没有办法正确地做到这一点,而不使subviewGroup成为可选项?
这是一个使用可选的工作示例
/*** Initializers ***/
init(frame: NSRect) {
super.init(frame: frame)
subviewGroup = GridViewGroup(rows: 9, columns: 9, gridView: self)
}
/*** Properties ***/
let subviewGroup: GridViewGroup?
Run Code Online (Sandbox Code Playgroud)