Tuesday, March 1, 2011

Adding JS code to your iPhone projects

IF you ever had a problem like this before, then there is a simple solution.

!! Warning: no rule to process file '$(PROJECT_DIR)/SomeJSFile.js' of type sourcecode.javascript for architecture i386

You can just ignore this warning, as you know that it isn't going to compile this code anyway.

But another odd thing you may think is that

NSString *path = [[NSBundle mainBundle] pathForResource:@"SomeJSFile" ofType:@"js"];

doesn't work either. It will always return nil.

Go to targets, and look under Compile sources, and drag the JS file into Copy Bundle Resources. And Bingo! Both issues resolved.

The sun is shining again.

2 comments:

  1. thanks for sharing how to ad js code.for Demo tools free download software collection by different server like hotfile, rapidshare ,fileserve ,hotfile ,filefactory meny more.visit http://demotoolsfreedownload.blogspot.com/

    ReplyDelete
  2. bbc sport football has lastest news of football from bbc official sites ,plus most amazing moment of best soccer players in the world
    http://bbcsport-football.blogspot.com/

    ReplyDelete