簡體   English   中英

我可以在Objective-C中獲得markdown文件的內容嗎?

[英]Can I get markdown file's contents in Objective-C?

我可以通過以下方式獲取.txt文件的內容:

NSString *articlePath = [[NSBundle mainBundle] pathForResource:@"test" ofType:@".txt"];
return [NSString stringWithContentsOfFile:articlePath encoding:NSUTF8StringEncoding error:nil];

但是,當文件為降價文件時,則沒有用:

NSString *articlePath = [[NSBundle mainBundle] pathForResource:@"test2" ofType:@".md"];
return [NSString stringWithContentsOfFile:articlePath encoding:NSUTF8StringEncoding error:nil];

articlePath為“ nil”,但該文件實際存在。

我想知道是否可以使用任何方法來獲取.md文件的內容。

提前致謝。

轉到:目標->“構建階段”->“復制捆綁資源”,然后在此處添加該特定文件。

確保存在test2文件 在此處輸入圖片說明

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM