Dyld: 符号未找到:__TMdV12CoreGraphics7CGFloat。

3

我正在使用苹果的新编程语言Swift在Xcode 6中编写一个SpriteKit游戏。虽然我对Swift比较陌生,但是在Xcode 6 Beta 3中成功地构建了应用程序。然而,自从Beta 4发布以来,我就无法在我的iPhone上运行该应用程序,尽管iOS模拟器仍然可以工作。

我的iPhone正在运行iOS 8 Beta 4,应用程序是在我的Mac上的Xcode 6 Beta 4上运行,该机器正在使用OS X Yosemite Beta 4。当启动应用程序时,在打开游戏的第一个场景之前就会出现错误,完整的错误信息在这里:

dyld: Symbol not found: __TMdV12CoreGraphics7CGFloat
  Referenced from: /private/var/mobile/Containers/Bundle/Application/5FA54F59-06DB-4044-AB46-B53431A70E79/Rollathon.app/Rollathon
  Expected in: /private/var/mobile/Containers/Bundle/Application/5FA54F59-06DB-4044-AB46-B53431A70E79/Rollathon.app/Frameworks/libswiftCoreGraphics.dylib
 in /private/var/mobile/Containers/Bundle/Application/5FA54F59-06DB-4044-AB46-B53431A70E79/Rollathon.app/Rollathon
(lldb)

我的第一个场景是这样的:

import SpriteKit
import CoreGraphics

class GameScene: SKScene {
    let playBtn = SKSpriteNode(imageNamed: "playBtn")
    let title = SKSpriteNode(imageNamed: "title")
    let settings = SKSpriteNode(imageNamed: "settings")
    
    override func didMoveToView(view: SKView) {
        // Setup background
        self.backgroundColor = UIColor(hex: 0x80D9FF);
        
        // TODO: ADD SETTINGS
        
        // Setup play button
        self.playBtn.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame))
        self.playBtn.setScale(0.2)
        
        // TODO: Setup title image
        //self.title.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMaxY(self.frame) - (self.title.size.height / 1.5))
        
        // Add scene children
        self.addChild(self.playBtn)
    }
    
    override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
        /* Called when a touch begins */
        
        for touch: AnyObject in touches {
            let location = touch.locationInNode(self)
            if self.nodeAtPoint(location) == self.playBtn {
                // User has pressed play
                var scene = PlayScene(size: self.size)
                let skView = self.view as SKView
                skView.ignoresSiblingOrder = true
                scene.scaleMode = .ResizeFill
                scene.size = skView.bounds.size
                skView.presentScene(scene)
            }
            
        }
    }
   
    override func update(currentTime: CFTimeInterval) {
        /* Called before each frame is rendered */
    }
}

这很简单,所以我怀疑问题是由其他场景引起的;如果需要,我将上传更多场景。


2
你尝试过清除所有派生数据吗?Apple在beta 4中更改了CGFloat的实现。 - Martin R
是的,从Xcode运行Product -> Clean。按住Option键以清除所有内容。 - CodeSmile
谢谢!我清除了所有交付日期,现在它运行良好! - Milese3
1个回答

5

将应用程序从您的设备中删除,进行清理,然后再次运行。可能是某些已编译代码的旧版本未被清除。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接