【发布时间】:2013-12-20 06:07:10
【问题描述】:
我正在尝试使用代码读取字符串中的整个 .m 文件:
NSString* fullFileName = @"file.m";
NSString* fileName = [[fullFileName lastPathComponent] stringByDeletingPathExtension];
NSString* extension = [fullFileName pathExtension];
NSString* filePath =[[NSBundle mainBundle] pathForResource:fileName ofType:extension];
NSString* fileTextContent=[NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:NULL];
但它返回null。
是否可以在 iOS 的字符串中从 bundle 中读取 .m 文件?
【问题讨论】:
标签: ios iphone objective-c nsstring