Search code examples
iosibooks

path of the directory where ibooks's pdf stored ios


I need to get the already existing pdf files in the device and to upload the selected pdf to the server. I've added one pdf file to iBooks and then tried searching that file in directory using this code:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];

NSFileManager *fileManager = [NSFileManager defaultManager];
//NSError *error = nil;
NSArray *filesAtPath = [fileManager contentsOfDirectoryAtPath:documentsDirectory error:nil];
NSLog(@"filesAtpath:%@",filesAtPath);
for (NSString *path in filesAtPath)
{
    NSLog(@"add..");
    if ([path rangeOfString:@".pdf"].length > 0)
    {
        //Do whatever you want with the pdf file
        NSLog(@"pdf: %@",path);
    }
}

but the log shows empty array, could you please tell me, is there any other method to get the pdf list in the device and select one to upload in the server.


Solution

  • No, Apple does not provide access to iBooks library in the same way that it provides some access to the Music library.