在使用Xcode 6 beta 6构建Swift程序时,我收到一个来自链接器的错误消息,目标是iOS 8.这个代码使用beta 5编译和运行。
Undefined symbol for architecture x86_64: __TFSs26_forceBridgeFromObjectiveCU__FTPSs9AnyObject_MQ__Q_",referenced from: __TFC8RayTrace14RayTracingPlot15drawFocalPointfS0_FT_T_ in RayTracingPlot.o ld: symbol(s) not found for architecture x86_64
这里是有问题的代码:
private func drawFocalPoint() { var attributes = Dictionary<String,AnyObject>() let FString: String = "F" let distance: CGFloat = focalDistance let centerX = CGRectGetMidX(bounds) let centerY = CGRectGetMidY(bounds) let circleRadius: CGFloat = 4.0 let focalPointFrame = CGRectMake(0,circleRadius * 2.0,circleRadius * 2.0) var path = UIBezierPath(ovalInRect: focalPointFrame) let color = UIColor.blackColor() let currentContext = UIGraphicsGetCurrentContext() CGContextSaveGState(currentContext) let shadowColor = UIColor(white:0,alpha:0.75).CGColor CGContextSetShadowWithColor(currentContext,CGSizeMake(0,4),CGFloat(8),shadowColor) // Image F var imageFPath = UIBezierPath(CGPath: path.CGPath) let imageFTransform = CGAffineTransformMakeTranslation((centerX - distance - circleRadius),(centerY - circleRadius)) imageFPath.applyTransform(imageFTransform) color.set() imageFPath.fill() FString.drawAtPoint(CGPointMake(centerX - distance - circleRadius,centerY + 5),withAttributes:attributes) CGContextSetShadowWithColor(currentContext,CGSizeMake(0.0,0.0),CGFloat(0.0),nil) // Clear shadow CGContextRestoreGState(currentContext) }
我会欣赏一个提示,在这个代码中寻找错误,所以我可以解决它。谢谢。
我得到这个错误,即使是新版本的Beta6是发布时间后,坏的被拉。
我已经解决了这个和其他类似的错误,通过删除Derived文件夹的内容。您可以前往[偏好设定]>找出该资料夹的所在位置。地点。
默认路径为:
/ Users / [您的用户名] / Library / Developer / Xcode / DerivedData
您还可以在Xcode中打开产品菜单时按住选项,这将更改为清理构建文件夹…并完成相同的任务,而不必进行文件夹搜索。