Swift beta 6-혼란스러운 링커 오류 메시지
iOS 8을 대상으로하는 Xcode 6 베타 6으로 Swift 프로그램을 빌드 할 때 링커로부터 오류 메시지가 나타납니다.이 코드는 베타 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입니다.
또한 저장할 수있는 Option
제품 메뉴가 변경됩니다 엑스 코드에서 열려있는 동안 Clean
에 Clean Build Folder
... 그리고 폴더 사냥을하지 않고 동일한 작업을 수행.
이 오류의 또 다른 원인 (Xcode 6.1.1 및 Xcode 6.2 베타 3에서 확인 됨)은 한 클래스에 케이스가 하나만있는 열거 형이 있고 두 번째 클래스에서 해당 유형의 변수를 선언하는 것입니다.
이 코드는 링커 오류를 발생시킵니다.
class ClassA {
enum ExampleEnum {
case Option1
}
}
class ClassB {
var example: ClassA.ExampleEnum = .Option1
}
이것은 그것을 고칠 것입니다.
class ClassA {
enum ExampleEnum {
case Option1
case Option2 // Added a second case
}
}
class ClassB {
var example: ClassA.ExampleEnum = .Option1
}
자세한 정보 및 샘플 프로젝트를위한 레이더 : http://openradar.appspot.com/19369147
하나의 케이스 만있는 열거 형은 실제로는 거의 쓸모가 없으므로 컴파일러는 아마도 그것을 최적화하거나 다른 것입니다. 나중에 결정될 업적에 대한 열거 형을 사용하여 새 프로젝트를 설정할 때이 문제가 발생했으며 자리 표시자가 1 개뿐입니다.
Also note: Use Watchdog http://watchdogforxcode.com/ to avoid having to worry about Derived Data issues.
For other people that might stumble on this error. I have had this when implementing CocoaPods
and not setting my target's Other Linker Flags
to $(inherited)
참고URL : https://stackoverflow.com/questions/25371556/swift-beta-6-confusing-linker-error-message
'developer tip' 카테고리의 다른 글
팬더 그룹 별 누적 합계 (0) | 2020.12.11 |
---|---|
Windows에서 npm 실행 스크립트에 대한 셸을 설정하는 방법 (0) | 2020.12.11 |
요소에 이벤트 리스너가 있는지 확인하십시오. (0) | 2020.12.11 |
C에서 free와 malloc은 어떻게 작동합니까? (0) | 2020.12.10 |
PLIST를 JSON으로 변환하는 명령 줄 도구? (0) | 2020.12.10 |