Xcode 6 GM won't compile for iOS device, but is fine in simulator - odd error message

余生长醉 提交于 2019-12-11 03:38:30

问题


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:'

at this line:

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)

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

  • Cleaned the whole project and re-built.
  • Deleted all Derived Data from ~/Library/Developer/XCode
  • Re-installed XCode
  • Checked XCode preferences and pointed Command Line Tools location to XCode 6 (XCode 5 is still installed on the machine and it was pointing there)

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

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

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


回答1:


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.

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

'Enable Modules (C and Objective-C': 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.

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.

Carl



来源:https://stackoverflow.com/questions/25754324/xcode-6-gm-wont-compile-for-ios-device-but-is-fine-in-simulator-odd-error-me

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!