Emmy
Emmy

Reputation: 3999

How to add existing files from ios app to dropbox server using sync api?

All the documents from dropbox and other tutorials are talking about create the new files and sync with dropbox using sync api.

I have some files my app document directory and I'd like to sync them with dropbox server.

Here is what I did.

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *path = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"emmy.txt"];

    DBPath *newPath = [[DBPath root] childPath:path];
    DBFile *file = [[DBFilesystem sharedFilesystem] createFile:newPath error:nil];
    //[file writeString:str error:nil];

    DBFileStatus *status = file.status;
    if (!status.cached) {
        [file addObserver:self block:^() {
        }];

    }

The file created on dropbox but it is empty. The file in my app has content.

How can I upload the existing files to dropbox in my app using dropbox sync api?

Upvotes: 1

Views: 276

Answers (1)

user94559
user94559

Reputation: 60143

I think you want writeContentsOfFile.

Upvotes: 1

Related Questions