문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top