得到上传的图片的URL链接与SDK来收存箱(GET URL link from uploaded i

2019-06-24 08:50发布

使用SDK将影像上传到一个文件夹,我想获得原始链接图像。 我曾尝试使用下面的方法搜索的元数据从DMMetaData。 有通过DBMetaData拥有的几种方法,如“根”和“内容”,但我总是收到一个空的响应。 如果任何人有可能导致我在正确的方向上抢从将不胜感激响应的信息!

-(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);

}

Answer 1:

为了得到一个可共享的链接中的Dropbox文件!

有一个在DBRestClient.h的方法,你应该看看!

- (void)loadSharableLinkForFile:(NSString *)path;

和他们的代表的方法,以及!

- (void)restClient:(DBRestClient*)restClient loadedSharableLink:(NSString*)link 
forFile:(NSString*)path;
- (void)restClient:(DBRestClient*)restClient loadSharableLinkFailedWithError:(NSError*)error;

例如:让我们考虑我在我的Dropbox文件MyContacts然后分享它,

[[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);
}


文章来源: GET URL link from uploaded image to dropbox with SDK