Search code examples
objective-ciosxcodeatmhud

Troubleshooting tons of missing, very basic Objective-C classes


I have an iOS project in Xcode that works great. I added the classes from the ATMHud project (https://github.com/atomton/ATMHud), which I have used successfully in other projects, and I'm suddently getting dozens of errors about missing interface declarations for very basic object types like NSObject and UIView:

36 errors, nine warnings

Per the documentation, I have added the QuartzCore and AudioToolbox frameworks to my project. I checked my own .h and .m files to make sure that all my custom #import statements are in my .m files and not the .h files unless necessary. I actually have only a single chain of #import statements in header files, and they're all related to the custom classes I've written.

I see a lot of answers to questions like this on here, but none of them are helping me solve my issue. I feel like I'm missing something obvious, but if it is, it eludes me. Any help would be appreciated.


Solution

  • If you are missing basic things like NSObject and UIView it sounds to me like you are not importing UIKit and Foundation anymore. These things are usually imported in the prefix file (myProject-Prefix.pch).

    There are two probable reasons why you could be missing these imports. Either you have rearranged the folder structure and the prefix file is no longer where it used to be or you have changed some of the build settings for your target. It is quite likely that you changed some of the build settings when you added the thirds party classes.

    To fix the issue, select your target and go into the build settings and search for "prefix header". The path that is defined there should be the path to your prefix file relative to your myProject.xcodeproj-file.

    You could also have changed the code inside the prefix file to no longer include UIKit and Foundation but you would probably remember doing that