How to get URL for application's document directory iPhone
<p>This code is a part of Core Data. The URLsForDirectory....method does not run on iOS &lt; 4 so I need to know some other methods/objects to call. I would also appriciate documentation for future reference. Thank you</p>

<pre><code>/**
 Returns the URL to the application's Documents directory.
*/
- (NSURL *)applicationDocumentsDirectory
{
    return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
}
</code></pre>

<hr>

<p>EDIT, problem solved. Updated post with answer.</p>

<pre><code>/**
 Returns the URL to the application's Documents directory.
 */
- (NSURL *)applicationDocumentsDirectory
{
    NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentPath = [searchPaths lastObject];

    return [NSURL fileURLWithPath:documentPath];
}
</code></pre>
