cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Obj-C download destination + two questions on method names

Obj-C download destination + two questions on method names

Keith B.7
Helpful | Level 7
Go to solution

Hello again,

 

Three quick questions:

 

1. To download a file, I use -downloadUrl:overwrite:destination:.

 

The documentation for the latter says:

 

"A closure used to compute the destination, given the temporary file location and the response."

 

What exactly does this mean in practice? More specifically: you set a destination URL using the destination parameter, telling the SDK where you want the file downloaded. Then, the response callback provides the final URL. i.e.:

 

NSURL *destinationURL = @"/user/username/documents/file.txt";
        DBDownloadUrlTask *downloadTask = [self.dropboxClient.filesRoutes downloadUrl:@"/my/file.txt" overwrite:YES destination:destinationURL];
        [downloadTask response:^(DBFILESMetadata *metaData, DBFILESDownloadError *downloadError, DBError *dbError, NSURL *downloadURL){
            
        }];

So, my question is: in the above snippet, is downloadURL guaranteed to be the same as destinationURL because I set overwrite to YES? I'm assuming (and hoping) that the final file URL of the downloaded file on disk (downloadURL in the above example) will only ever differ from the destination URL passed into -downloadUrl:... (destinationURL in the above example) if overwrite is set to NO. Is that assumption correct?

 

Then two unimportant questions sprung purely from my curiosity on certain method names:

 

2. What is the significance of the underscore at the end of DBFILESRoutes's "delete" method? That is, why is it "delete_:" instead of "delete:"?

 

3. What is the significance of the "d" prefix of all the copy methods - "dcopy" instead of "copy"?

 

Thanks!

Keith

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

1. That's correct, since overwrite is NO, destinationURL will be the same as downloadURL. (The documentation is a little misleading due to an old reference to "closure". We'll get that fixed up.)

 

2. and 3. These methods have these modifications to avoid some reserved keyword/prefix constraints in Objective-C/Cocoa. It's non-ideal of course, but there's nothing special you need to do on your side beyond use those inconsistent names.

View solution in original post

2 Replies 2

Greg-DB
Dropbox Staff
Go to solution

1. That's correct, since overwrite is NO, destinationURL will be the same as downloadURL. (The documentation is a little misleading due to an old reference to "closure". We'll get that fixed up.)

 

2. and 3. These methods have these modifications to avoid some reserved keyword/prefix constraints in Objective-C/Cocoa. It's non-ideal of course, but there's nothing special you need to do on your side beyond use those inconsistent names.

Keith B.7
Helpful | Level 7
Go to solution

Great, thanks again!

 

All the best,
Keith

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Keith B.7 Helpful | Level 7
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?