Reputation: 6178
I can get the contents of a .txt file in this way:
NSString *articlePath = [[NSBundle mainBundle] pathForResource:@"test" ofType:@".txt"];
return [NSString stringWithContentsOfFile:articlePath encoding:NSUTF8StringEncoding error:nil];
However,it is no use when the file is a markdown file:
NSString *articlePath = [[NSBundle mainBundle] pathForResource:@"test2" ofType:@".md"];
return [NSString stringWithContentsOfFile:articlePath encoding:NSUTF8StringEncoding error:nil];
The articlePath
is "nil",but the file is exist actually.
I wonder if there any method I can use to get the contents of a .md file.
Thanks in advance.
Upvotes: 0
Views: 131
Reputation: 6067
Go to : Target -> "Build Phases" -> "copy bundle Resources" Then add that particular file here.
Make sure that test2 file is there
Upvotes: 2