Search code examples
iosquickblox

Quickblox - iOS - Content - get url blobID


we have being able to get content files by blob_id with your code:

[QBContent TDownloadFileWithBlobID:126  delegate:self];

#pragma mark -
#pragma mark QBActionStatusDelegate

- (void)completedWithResult:(Result *)result{
    if(result.success && [result isKindOfClass:[QBCFileDownloadTaskResult class]]){
        QBCFileDownloadTaskResult *downloadfileResult = (QBCFileDownloadTaskResult *)result;

        // do something with file
        NSData file = downloadfileResult.file;
    }else{
        NSLog("errors=%@", result.errors);
    }
}

I would like to know if there is a way to get the image URL using the blob_id

thanks for your help


Solution

  • Yes, for example

    [QBContent blobWithID:910 delegate:self];
    
    - (void)completedWithResult:(Result *)result{
    
        // success result
        if(result.success){
            if([result isKindOfClass:QBCBlobResult.class]){
                QBCBlobResult *res = (QBCBlobResult *)result;
                NSLog(@"url=%@", res.blob.publicUrl); 
            }
        }
    }
    

    But, to be able to do this you should upload a file and set isPublic to YES

    If file is private - you can't use a publicUrl property