问题描述
使用SDK将图像上传到文件夹我想获得图像的原始链接。我使用下面的方法从DMMetaData搜索了metaData。 DBMetaData拥有几种方法,例如root和content,但我总是收到Null响应。如果有人能够引导我朝正确的方向从响应中获取那些非常感谢的信息!
Uploading images to a folder using the SDK I would like to get the original link to the image. I have searched the the metaData from DMMetaData using the method below. There are several methods owned by DBMetaData such as "root" and "content" but I always recieve a Null response. If anyone could possibly lead me in the right direction to grab that information from the response that would be greatly appreciated!
-(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中文件的可共享链接!
To get a sharable link for a file in DropBox !
DBRestClient.h中有一个方法,你应该看看!
There is a method in DBRestClient.h that you should take a look at!
- (void)loadSharableLinkForFile:(NSString *)path;
及其代表方法!!
- (void)restClient:(DBRestClient*)restClient loadedSharableLink:(NSString*)link
forFile:(NSString*)path;
- (void)restClient:(DBRestClient*)restClient loadSharableLinkFailedWithError:(NSError*)error;
示例:让我们考虑一下我的Dropbox
中的文件MyContacts然后分享它,
example : let us consider i have a file MyContacts in my Dropboxthen to share it ,
[[self restClient] loadSharableLinkForFile:@"/MyContacts"];
及其委托方法
- (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);
}
这篇关于使用SDK获取从上传图像到Dropbox的URL链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!