iPhone OS 3.2 File Sharing Path
-
05-10-2019 - |
문제
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?
해결책
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.
제휴하지 않습니다 StackOverflow