2

SDK を使用してフォルダに画像をアップロードする 画像への元のリンクを取得したいと思います。以下の方法を使用して、DMMetaData からメタデータを検索しました。「root」や「content」など、DBMetaData が所有するいくつかのメソッドがありますが、常に 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);

}
4

1 に答える 1

10

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);
}
于 2012-05-12T13:35:32.197 に答える