Start a new topic

Fetching and presenting images stored as Files - Very slow

I store my User's profile image in the File Store and I keep the file_id as a custom attribute in KCSUser.

My problem is that when I download and present this image,updating UI takes too long.

My Images have size 6kB and I use SDK 1.26.3 (latest)

Here's my code:


[KCSFileStore downloadFile:file_id options:nil completionBlock:^(NSArray *downloadedResources, NSError *error) {

if (error == nil) {

KCSFile* file = downloadedResources[0];

NSURL* fileURL = file.localURL;

ProfileImage.image = [UIImage imageWithContentsOfFile:[fileURL path]];

} else {

NSLog(@"Got an error: %@", error);


} progressBlock:nil];



Is there any other way I could possibly store an image and have access to it through KCSUser?

Any suggestions?

1 person has this question

You can easily modify backend data Yonghui...

I don't think it is a good idea to keep the file_id as a custom attribute in KCSUser. 

Because Kinvey doesn't allow programmers to modify (or add or delete) backend data, if a user changes profile image, we can do nothing to update to the new image. 

The KCSFileStore callbacks don't happen on the main thread. This means UI updates are unpredictable. Try wrapping the UI code with a `dispatch_async` like:

dispatch_async(dispatch_get_main_queue(), ^{

profileImage.image = [UIImage imageWithData:fileData];

Check mail :)
Can you send us a sample project that reproduces this issue?