Where to place your application files after enabling UIFileSharingEnabled

After you enable UIFileSharingEnabled in your app and connect to your development device to iTunes you will notice that all of your files are exposed.

If you have been using something like the code below then your files will be exposed to the user from iTunes with UIFileSharingEnabled set to YES.

NSString *documentDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];

There is a simple workaround. Instead of the above code try this:

NSString *libraryDir = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0];

Here is a link to information on Apples site to back this practice.

Hope this helps someone