Xcode 6 GM 不会为 iOS 设备编译,但在模拟器中很好 - 奇怪的错误消息 [英] Xcode 6 GM won't compile for iOS device, but is fine in simulator - odd error message

查看:27
本文介绍了Xcode 6 GM 不会为 iOS 设备编译,但在模拟器中很好 - 奇怪的错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在 XCode 6 beta 中编译得很好的项目,但是现在,在 GM 中,它无法为 iOS 设备编译,并给出错误:

I have a project that compiled just fine in XCode 6 beta, but now, in the GM, it won't compile for an iOS device, giving the error:

myController.m:393:9: No visible @interface for 'UIDevice' declares the selector 'initialize:'

在这一行:

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)

对于模拟器来说,它仍然可以很好地编译;我也试过这些修复:

It still compiles absolutely fine for the simulators; I've also tried these fixes:

  • 清理整个项目并重新构建.
  • 从 ~/Library/Developer/XCode 中删除了所有派生数据
  • 重新安装 XCode
  • 检查 XCode 首选项并将命令行工具位置指向 XCode 6(XCode 5 仍然安装在机器上,它指向那里)

...但没有运气.编译时出现同样的错误.

...but with no luck. Same error on compilation.

帮助!随着 iOS8 的临近,我们的时间紧迫,这真是令人头疼.

Help! We're on a tight timescale with iOS8 now approaching, and this is a real headache.

PS:我们也在工作区中使用 Cocoapods,这是值得的.

PS: We're also using Cocoapods in the workspace, for what it's worth.

推荐答案

好的,我费了好大劲才解决了这个问题.有问题的应用程序是一个 iOS 8 应用程序,带有嵌入式今日扩展.

OK, I solved this one after rather a lot of hair-pulling. The app in question is an iOS 8 app, with an embedded Today Extension.

原来,在添加Today Extension时,XCode已经添加了一个构建设置:

It turned out that, when adding the Today Extension, XCode had added a build setting:

'启用模块(C 和 Objective-C':是

'Enable Modules (C and Objective-C': YES

我的项目和包含的应用程序目标都没有使用此构建设置,但将其设置为 YES 会导致与尝试自动链接框架(和失败)以及最终与头文件相关的各种相关奇怪错误消息有关的问题.

Neither my project nor my containing app targets used this build setting, but setting it to YES caused issues to do with trying to link Frameworks automatically (and failing) and all sorts of related odd error messages that ultimately related to header files.

问题进一步复杂化,因为有些源文件既是包含应用程序的目标成员,又是 Today Extension 目标的成员.

The problem was further compounded because there are source files that are members of both the containing app's target and also the Today Extension's target.

希望这些信息对其他人有所帮助.

Hope this info helps somebody else.

卡尔

这篇关于Xcode 6 GM 不会为 iOS 设备编译,但在模拟器中很好 - 奇怪的错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆