Reputation: 294
This is how my file.mm looks like:
const char *readFromFileMac(const char *fileName) {
fileName =[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent: @(fileName)].UTF8String;
return fileName;
}
Xcode gives me the error Use of undeclared identifier 'NSBundle'
. Do I need to include some framework or header file to be able to use the NSBundle
name?
The only thing I have done is to copy my project to an other directory. After the copy I got this error, its was working before. I am using Xcode 8.2
Upvotes: 0
Views: 1477
Reputation: 9753
Try #import <Foundation/Foundation.h>
Remember to add the Foundation.framework
to your linked libraries/frameworks.
Upvotes: 6
Reputation: 2561
Go to Your project Setting > Build Phases > Frameworks > Search For (Foundation) and add it. once done. go to your.h file and place is below
#import <Foundation/Foundation.h>
Upvotes: 2