简体   繁体   English

Xcode 6 Beta 5 Swift游乐场:无法找到CGRectMake()的符号

[英]Xcode 6 Beta 5 Swift Playground: Cannot find symbol for CGRectMake()

Since updating to Xcode 6 beta 5 my playground code will no longer compile/run and logs: 自从更新到Xcode 6 beta 5后,我的游乐场代码将不再编译/运行和记录:

Playground execution failed: error: Couldn't lookup symbols: _CGRectMake

It should be simple enough and worked fine on the previous versions. 它应该足够简单并且在以前的版本上运行良好。 The only code I am running up to that point is as follows: 我到目前为止唯一运行的代码如下:

import Foundation
import UIKit
import XCPlayground
import QuartzCore
let frameRect: CGRect = CGRectMake(0, 0, 500, 500)
var customView = UIView(frame: frameRect)

Just wondering if anyone else is having problems with Playground and found solutions. 只是想知道是否有其他人遇到Playground问题并找到解决方案。 My hunch is that is just a beta bug. 我的预感是这只是一个测试版漏洞。

You should use let rect = CGRect(x: 0, y: 0, width: 500, height: 500) instead. 您应该使用let rect = CGRect(x: 0, y: 0, width: 500, height: 500)

CGRectMake still works for me though... Did you create a new playground with beta 5? CGRectMake仍然适用于我...你是否用beta 5创建了一个新游乐场? I've found it's best to always create a new playground for each new beta. 我发现最好总是为每个新测试版创建一个新游乐场。

Try just removing the "make": 尝试删除“make”:

import Foundation
import UIKit
import XCPlayground
import QuartzCore
let frameRect: CGRect = CGRect(0, 0, 500, 500)
var customView = UIView(frame: frameRect)

Also, you may get another weird error with your view when you import XCPlayground, so try this: 此外,导入XCPlayground时,您的视图可能会出现另一个奇怪的错误,因此请尝试以下操作:

customView.setTranslatesAutoresizingMaskIntoConstraints(true)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM