tags:

views:

55

answers:

2
+1  A: 

Is your index.html actually named Index.html? I believe pathForResource:ofType is case sensitive.

Jasarien
yes it is index.html do i need to do some UTF8 encoding???/
ram
+1  A: 

pathForResource:ofType: is returning nil, and initFileURLWithPath: is complaining about it. Trap that error like so:

if(nil == pathb) {
    NSLog("Couldn't find object named %@", [a3 objectAtIndex:0]);
} else {
    NSURL   *instructionsURLb = [[NSURL alloc] initFileURLWithPath:pathb];
    [webView loadRequest:[NSURLRequest requestWithURL:instructionsURLb]];          
}

and double check that you're searching for an object that actually exists in your bundle.

Seamus Campbell
it is existing if i type @"index" then its working fine . else not :(i tried your code and i got this-[UIRoundedRectButton length]: unrecognized selector sent to instance 0x3b14ab02010-08-09 08:40:37.924 ramdev[1641:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UIRoundedRectButton length]: unrecognized selector sent to instance 0x3b14ab0'
ram
Then whatever is returned by `[a3 objectAtIndex:0]` is not what you're expecting it to be. Verify that the `a3` array is valid and that it actually contains the string `@"index"` at index 0.
Jasarien
Doesn't sound like [a3 objectAtIndex:0] == @"index", then.
Seamus Campbell
hey [a3 objectAtIndex:0] == index not @"index" should i make it like @"index"?? ohh god let me try then
ram
i think path for rsource looks for this pathfile://localhost/Users/applefan/Library/Application%20Support/iPhone%20Simulator/3.1.3/Applications/A582538C-75CF-48BB-B864-74CCA1BA6900/ramdev.app/ so i think i have to append this along with index then only it will become complete ???
ram
hey i did even this NSString *urlString = [NSString stringWithFormat:@"@\"%@\"",[a3 objectAtIndex:0]]; == @"index" still no luck ???
ram
I think the string you're constructing there is actually @"@"index"", not @"index". When we write @"index", only the text between the quotes is the string itself. The @ tells us that it's an NSString*, not a C-style null-terminated char array.
Seamus Campbell
Also, pathForResource should be giving you the path you're describing.
Seamus Campbell
ok see value of my string is s==@"index" (for sure)pathb = [thisBundleb pathForResource:s ofType:@"html"];now when i pass like this NSURL *instructionsURLb = [[NSURL alloc] initFileURLWithPath:path]; NSLog(@"[ath 1 IS %@",instructionsURLb );==NULL??
ram
i will update in new thread i guess .. its messy here Thanks Seamus i will make it more clear in new thread
ram
My suggestion here is that you take this one step at a time. Rather than checking the value of instructionsURLb, see if you're getting a sane value for pathb. Only when you have something that looks like good output from pathForResource:ofType should you worry about opening it.
Seamus Campbell
YOu are right my path =null but pathForResource:s is having @"index" value oh god what i am doing wrong daaam ok i will cross check again
ram
wow yes i did it thanks a lot i have to do UTF8encoding before path :-) thanks a lot SEAMUS
ram