开发者

Application crashes at [[NSBundle mainBundle] pathForResource

开发者 https://www.devze.com 2023-04-06 20:00 出处:网络
My Application is crashes in the device at this point, [[NSBundle mainBundle] pathForResource I am giving the path for the pdf here . but at the execution time it is showing that it is not getting

My Application is crashes in the device at this point,

[[NSBundle mainBundle] pathForResource

I am giving the path for the pdf here . but at the execution time it is showing that it is not getting path there . and that may be the reason for crashing.

however it is running perfectly on simulator .

i am not able to figure out why is this happening

here is that code

NSString *path = [[NSBundle mainBundle] pathForResource:[myArray objectAtIndex:0] ofType:[myArray objectAtIndex:1]];
NSLog(@"array elemt :%@", [myArray objectAtIndex:0]);
NSLog(@"ar开发者_运维技巧ray elemt 1 :%@", [myArray objectAtIndex:1]);
NSLog(@"path is :%@",path);
NSLog(@"responds to selector mainBundle=%@",[NSBundle respondsToSelector:@selector(mainBundle)]?@"YES""NO");
NSURL *targetURL = [NSURL fileURLWithPath:path];

in this log of the path - when i use device it is showing me nil and when i use simulator it is showing me the path . and it is showing me that is is crashing on NSURL line


I've found that when something like this works on the simulator, but not on the device, it's likely a problem with the case of the string. Your device is case sensitive but not your computer. Check your string of the file name or the type.

0

精彩评论

暂无评论...
验证码 换一张
取 消