使用 SDK 将图像上传到文件夹我想获取图像的原始链接。我使用下面的方法从 DMMetaData 搜索了元数据。 DBMetaData 拥有多种方法,例如“root”和“content”,但我总是收到 Null 响应。如果有人能够引导我朝着正确的方向从响应中获取该信息,我将不胜感激!
-(void)uploadImage:(UIImage *)image{
[sounds PlayUploading:nil];
NSLog(@"upload from uploader!~");
NSData *data = UIImagePNGRepresentation(image);
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *path = [[paths objectAtIndex:0] stringByAppendingString:@"PreviewMaker.png"];
[restClient setDelegate:self];
[data writeToFile:path atomically:YES];
[[self restClient] uploadFile:@"PreviewMaker.png" toPath:@"/"
withParentRev:nil fromPath:path];
}
-(void)restClient:(DBRestClient *)client uploadedFile:(NSString *)destPath
from:(NSString *)srcPath metadata:(DBMetadata *)metadata{
NSLog(@"uploaded: %@ from %@ withData %@",destPath,srcPath,metadata.root);
}
最佳答案
获取 DropBox 中文件的可共享链接!
DBRestClient.h 中有一个方法,您应该看看!
- (void)loadSharableLinkForFile:(NSString *)path;
以及它们的委托(delegate)方法!!
- (void)restClient:(DBRestClient*)restClient loadedSharableLink:(NSString*)link
forFile:(NSString*)path;
- (void)restClient:(DBRestClient*)restClient loadSharableLinkFailedWithError:(NSError*)error;
示例:让我们假设我的 Dropbox 中有一个文件 MyContacts 然后分享它,
[[self restClient] loadSharableLinkForFile:@"/MyContacts"];
及其委托(delegate)方法
- (void)restClient:(DBRestClient*)restClient loadedSharableLink:(NSString*)link
forFile:(NSString*)path
{
NSLog(@"Sharable link %@",link);
NSLog(@"File Path %@ ",path);
}
- (void)restClient:(DBRestClient*)restClient loadSharableLinkFailedWithError:(NSError*)error
{
NSLog(@"Error %@",error);
}
关于iphone - 使用 SDK 从上传的图像到 Dropbox 的 GET URL 链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10559607/