0

I have tried this in a variety of ways and yet it never pops out my file as a string. Any help would be much appreciated. Perhaps a fresh set of eyes can get it.

static NSString *JSParse;


JSParse = [NSString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"nameFinder" ofType:@"js" ] encoding:NSUTF8StringEncoding ];
NSString *filepath = [[NSBundle mainBundle] pathForResource:@"nameFinder" ofType:@"js"];
NSLog(filepath);
if (filepath)
{
    NSString *someJscript = [NSString stringWithContentsOfFile:filepath];
    NSLog(someJscript);
}
NSLog(@"StartParse");
NSLog(JSParse);
NSLog(@"End Parse");

The end goal is to use javascript to parse HTML from a website that isn't mine and yes it sucks. (Parsing although my code is suspect too at this point);

2 Answers 2

0

The solution is here: https://stackoverflow.com/a/2018644/526547

You don't need to change your .js to .txt if you use this method.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the clarity. Whats the odds you can help me with my mutable array stackoverflow.com/questions/8587818/…
0

The Reason for this has something to do with it being a JS file extension. Changing it to a txt file invariably fixes the problem. I'm not sure why this is so but i'm assuming it's some compilation issues.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.