gpt4 book ai didi

Swift beta 6 - 令人困惑的链接器错误消息

转载 作者:IT王子 更新时间:2023-10-29 04:58:39 25 4
gpt4 key购买 nike

在使用 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, 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 中打开 Product 菜单时按住 Option,这会将 Clean 更改为 Clean Build Folder...无需查找文件夹即可完成相同的任务。

关于Swift beta 6 - 令人困惑的链接器错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25371556/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com