如何将 *.pdf 所有 pdf 从我的 iphone 导入到我的应用程序中,像这样添加音乐文件。http://developer.apple.com/library/ios/#samplecode/AddMusic/Introduction/Intro.html。在此先感谢 。iPhone 开发新手。非常感谢任何帮助。
NSString *bundlePath = [[NSBundle mainBundle] resourcePath];
NSFileManager *mgr = [[NSFileManager alloc] init];
NSArray *allFiles = [mgr contentsOfDirectoryAtPath:bundlePath error:NULL];
for (NSString *fileName in allFiles)
{
if ([[fileName pathExtension] isEqualToString:@"pdf"])
{
NSString *fullFilePath = [bundlePath stringByAppendingPathComponent:fileName];
// fullFilePath now contains the path to your pdf file
// DoSomethingWithFile(fullFilePath);
NSLog(@"file: %@",fullFilePath);
}
}
NSURL *url = [[NSBundle mainBundle] URLForResource:@"" withExtension: @"pdf"];
NSLog(@"File: %@",url);