coredata sql store on WebDAV mounted volume

  • It seems that coredata sql stores can't be read or written from
    WebDAV volumes. It doesn't work with my app, or with the OutlineEdit
    demo app. Does anyone know of a workaround? If there is no work
    around what's the best way to test for this case so that I can give
    the user a more descriptive error message?

    Thanks,
    Jesse
  • On May 18, 2006, at 11:29 AM, Jesse Grosjean wrote:

    > It seems that coredata sql stores can't be read or written from
    > WebDAV volumes. It doesn't work with my app, or with the OutlineEdit
    > demo app. Does anyone know of a workaround? If there is no work
    > around what's the best way to test for this case so that I can give
    > the user a more descriptive error message?

    That is by design.

    WebDAV is incapable of supporting non-atomic reads/writes.  As such,
    there is no useful reason -- and many reasons not to -- store a SQLite
    database, through Core Data or otherwise, on a WebDAV based filesystem.

    Use an XML or Binary store instead.

    The following can be used to test FS type:

    int main (int argc, const char * argv[]) {
        NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

        struct statfs fsInfo;

        NSLog(@"Testing %s", argv[1]);
        if (statfs(argv[1],  &fsInfo) == -1) {
            NSLog(@"Error %s", argv[1]);
            exit(1);
        }

        if (fsInfo.f_flags & MNT_RDONLY) {
            NSLog(@"Read only %s", argv[1]);
            exit(0);
        }

        NSLog(@"Type %s", fsInfo.f_fstypename);

        [pool release];
        return 0;
    }