使用 Dropbox Objective-C SDK 上傳檔案
這使用 Dropbox Objective-C SDK 將本地檔案作為“/test.txt”上傳到 Dropbox。
[[client.filesRoutes uploadUrl:@"/test.txt" inputUrl:[NSURL fileURLWithPath:@"/local/path/to/test.txt"]] response:^(DBFILESFileMetadata *metadata, DBFILESUploadError *uploadError, DBRequestError *error) {
if (metadata) {
NSLog(@"The upload completed successfully.");
NSLog(@"File metadata:");
NSLog(@"%@", metadata);
} else if (uploadError) {
NSLog(@"Something went wrong with the upload:");
NSLog(@"%@", uploadError);
} else if (error) {
NSLog(@"Something went wrong with the API call:");
NSLog(@"%@", error);
}
}];