Question

Currently I have this for my file path and file...

NSURL *storeUrl = [NSURL fileURLWithPath: [[self applicationDocumentsDirectory] stringByAppendingPathComponent: @"Shared\PartyPlanner.sqlite"]];

This allows me to share the file with iTunes, but instead of just having 'PartyPlanner.sqlite' in the 'applicationDocumentsDirectory\Shared'

I have "SharedPartyPlanner.sqlite" in the 'applicationDocumentsDirectory'

is there a cleaner or easier way to get to the shared folder inside of applicationDocumentsDirectory?

Was it helpful?

Solution

In UNIX-like systems (including the iPhone OS), the directory separator is /, not \.

Also, in C-like languages (including Objective-C), the \ in a string is used to escape a character, e.g. \n → a new line. You need to type Shared\\PartyPlanner.sqlite if you really need a backslash in the file name.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top