Skip to main content
Question

how to actually retrieve the sharedLink URL for the uploaded file via the logged in app user

  • May 21, 2025
  • 2 replies
  • 7 views

Forum|alt.badge.img
The following code is being used to upload a file to a folder in Box and that part is working successfully.  Upon successful completion of the upload, the file object is not returning the sharedLink.URL for the file though (current example shows that value being logged to the debug window in the first NSLog statement that is in larger font than others).  So a BoxFileRequest is made to retrieve information about that file but it too returns a nil value in the sharedLink.url property.  So how are we supposed to actually retrieve the sharedLink URL for the uploaded file via the logged in app user?
 
    @try{
      if((self.report.mediaType == VIDEO) || (self.report.mediaType == IMAGE)){
        NSURL *url = [NSURL URLWithString:self.report.mediaURLString];
        NSData* data = [NSData dataWithContentsOfURL: url];
        BOXFileUploadRequest *uploadRequest = [self.syncher.clientfileUploadRequestToFolderWithID:self.boxSourceFilesFolderID
                                                                                          fromData:data
                                                                                          fileName:self.report.visualMediaFileName];
        [uploadRequest performRequestWithProgress:^(long long totalBytesTransferred,long long totalBytesExpectedToTransfer) {
        } completion:^(BOXFile *file, NSError *error) {
          NSLog(@"file info url: %@", [file.sharedLink.url absoluteString]);

          BOXFileRequest *fileInfoRequest = [self.syncher.clientfileInfoRequestWithID:file.modelID];

          [fileInfoRequest performRequestWithCompletion:^(BOXFile *file, NSError*error) {
            NSLog(@"file info url: %@", [file.sharedLink.url absoluteString]);
            self.returnBoxVideoURLString = [file.sharedLink.url absoluteString];
            [self generatePDF];
          }];
        }];
      }  // end if

    

 
    }@catch (NSException *ex){

      

    }

2 replies

Forum|alt.badge.img

This looks like a possible duplicate post. I answered this question here.


Forum|alt.badge.img

Murtza thanks for caring and taking the time to solve the issue