Xcode Beta 6 - 使用未声明的类型“CLLocationManagerDelegate”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25581897/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 05:27:18  来源:igfitidea点击:

Xcode Beta 6 - Use of undeclared type 'CLLocationManagerDelegate'

xcodeswiftcllocationmanagerxcode6-beta6

提问by schnabler

I have just upgraded from Xcode 6 Beta 3 to Xcode 6 Beta 6. In Beta 3, everything worked fine and compiled like I wanted it to.

我刚刚从 Xcode 6 Beta 3 升级到 Xcode 6 Beta 6。在 Beta 3 中,一切正常,并且按照我想要的方式编译。

Right now, I cannot get CLLocationManagerDelegate to work, i.e. I always get the Use of undeclared type 'CLLocationManagerDelegate' - error message.

现在,我无法让 CLLocationManagerDelegate 工作,即我总是收到 Use of undeclared type 'CLLocationManagerDelegate' - 错误消息。

This is what my file looks like:

这是我的文件的样子:

import UIKit
import CoreLocation

class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, CLLocationManagerDelegate {

Additional info:

附加信息:

  • I have added the CoreLocation Framework (tried adding it within Xcode directly, also by drag-and-dropping the actual file from the folder, no changes)
  • I have had to reinstall Xcode 6 Beta 6 a couple of times before getting it to start (running OSX 10.9.4, always crashed on first startup)
  • As you can see, I import CoreLocation to my file.
  • CLLocationManagerDelegate does not autocomplete, it goes as far as CLLocationManager
  • 我已经添加了 CoreLocation 框架(尝试直接在 Xcode 中添加它,也通过从文件夹中拖放实际文件,没有更改)
  • 在启动之前,我不得不重新安装 Xcode 6 Beta 6 几次(运行 OSX 10.9.4,第一次启动时总是崩溃)
  • 如您所见,我将 CoreLocation 导入到我的文件中。
  • CLLocationManagerDelegate 不会自动完成,它就像 CLLocationManager

Any ideas? I'm assuming something is not linked properly here.

有任何想法吗?我假设这里没有正确链接。

回答by zisoft

Try to clean your build directory:

尝试清理您的构建目录:

Product-->Clean

产品展示-->清洁

Product-->(Alt key) Clean Build Folder

产品-->(Alt 键)清理构建文件夹

Delete your derived data:

删除您的派生数据:

Window-->Organizer-->delete derived data

窗口-->组织器-->删除派生数据

回答by Goodsquirrel

Another possible reason for the 'use of undeclared type' error is that your class is also within your testtarget, but the 'undeclared type' is not.

“使用未声明类型”错误的另一个可能原因是您的类也在测试目标内,但“未声明类型”不在。

回答by schnabler

This was a bug in XCode. Was solved in Beta7/Xcode6.

这是 XCode 中的一个错误。已在 Beta7/Xcode6 中解决。