I used the following code to get the documents
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
if([paths count] > 0)
{
NSString *documentsDirectory = [paths objectAtIndex:0];
NSLog(@"%@",documentsDirectory);
NSError *error = nil;
NSArray *documentArray = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:documentsDirectory error:&error];
if(error)
{
NSLog(@"Could not get list of documents in directory, error = %@",error);
}
else
{
NSLog(@"Hello %@",documentArray);
arrdocument = documentArray;
}
}
But it only show documents within my application, Not the outside of the application.
You cannot access files in other applications : each app is sandboxed.
I suggest you to read the File System Basics from Apple :
Every App Is an Island
An iOS app’s interactions with the file system are limited mostly to the directories inside the app’s sandbox. During installation of a new app, the installer creates a number of containers for the app. Each container has a specific role. The bundle container holds the app’s bundle, whereas the data container holds data for both the application and the user. The data container is further divided into a number of directories that the app can use to sort and organize its data. The app may also request access to additional containers—for example, the iCloud container—at runtime.
These containers constitute the app’s primary view of the file system.
Because it is in a sandbox, an app is generally prohibited from accessing or creating files outside its containers. One exception to this rule occurs when an app uses public system interfaces to access things such as the user’s contacts or music. In those cases, the system frameworks handle any file-related operations needed to read from or modify the appropriate data stores.