Can't find .js file in my mainBundle?!
- by Nic Hubbard
This is driving me crazy as I cannot figure out what in the world is going on. I load up files form you main bundle all the time, xml files, html files, etc. But, now I am trying to get the contents of a javascript file but it can never find it. I am using:
NSData *jsData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"global" ofType:@"js"]];
if (jsData) {
NSLog(@"%@", jsData);
} else {
NSLog(@"Can't find file");
return;
}
Even checking the [[NSBundle mainBundle] pathForResource:@"global" ofType:@"js"] string returns null.
My globaly.js file is in my Resources folder, the exact location where my other files are location that work totally fine using the above method.
Why can't it find my js file?