문제

I am using below code

// it is showing nil for path

NSString *path = [[NSBundle mainBundle] pathForResource:@"filetext.doc" ofType:nil];
NSURL *url1 = [NSURL fileURLWithPath:path];

// it is showing working

NSString *path = [[NSBundle mainBundle] pathForResource:@"filetext.txt" ofType:nil];
NSURL *url1 = [NSURL fileURLWithPath:path];

Please help what is the issue

도움이 되었습니까?

해결책

According to the docs, the method returns nil if the file cannot be found. The conclusion, therefore, is that the file is missing. Check your project's Build Phases/Copy Bundle Resources to ensure that the file is actually present because in all likelihood it is not.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top