As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
I have a UITableView that I am fetching data for. I have a function that gets entityIDs for KCSFiles, and it works fine if there are not duplicate IDs.
The issue is when the same user posts multiple times, only one KCSFile applies (Since it is the same user with the same profile picture). E.g. two IDs given (that are the same) and one KCSFile output. I need this to return every time, regardless of if it is the same file.
for ID in IDs {
print(ID)
KCSFileStore.downloadFile(ID, options: nil, completionBlock: { (pictures, error) in
if let pictures = pictures as? [KCSFile] {
for picture in pictures {
print(picture)
}
}
}, progressBlock: nil)
}
Outputs:
02c5040b-b9fe-49b8-b40c-62cd3559fcd2
02c5040b-b9fe-49b8-b40c-62cd3559fcd2
<KCSFile: 0x7fedb8da49d0>
Best Answer
P
Pranav J
said
over 7 years ago
Hi Elijah,
The error that these functions would throw when downloading the duplicate files is "Download already in progress.". So if you capture all the file id's for which this error occured and then retry downloading only these files again once the initial transfer is done, you should get the respective KCSFile objects filled in (and they would come from the cache).
The error that these functions would throw when downloading the duplicate files is "Download already in progress.". So if you capture all the file id's for which this error occured and then retry downloading only these files again once the initial transfer is done, you should get the respective KCSFile objects filled in (and they would come from the cache).
Thanks,
Pranav
Kinvey Support
P
Pranav J
said
over 7 years ago
Hi Elijah,
Can you let me know the error that you see in the completion block handler? When you are fetching the ID's would it be possible to send back only distinct id's? If you could provide additional information about the scenario as to how you are ending up with duplicate id's (any more code snippets would also do) that will enable to help better.
Thanks, Pranav
Kinvey Support
E
Elijah
said
over 7 years ago
Essentially I want to fetch a profile picture from a user relation–but duplicate IDs (of the user or their picture) only results in KCSFileStore fetching one object.
Let's assume I fetch all posts and users with a function and pass them in a completion block. All of the posts and users have distinct pointer addresses, and this works fine. However, when I try to fetch the profile pictures from each user, if a user is repeated, only one profile picture is fetched. I have tried KCSFileStore.downloadData and .downloadFile.
static func fetchPictures() {
fetchPostsAndUsers { (Posts, Users) in
for user in Users {
let pictureId = user.getValueForAttribute(kKinveyUser.profile_picture)
KCSFileStore.downloadData(pictureId, completionBlock: { (pictures, error) in
if let pictures = pictures {
// completion block
}
}, progressBlock: nil)
}
}
}
E
Elijah
said
over 7 years ago
I just want downloadData/downloadFile to return a picture.localURL or .remoteURL regardless of any conditions.
Elijah
I have a UITableView that I am fetching data for. I have a function that gets entityIDs for KCSFiles, and it works fine if there are not duplicate IDs.
The issue is when the same user posts multiple times, only one KCSFile applies (Since it is the same user with the same profile picture). E.g. two IDs given (that are the same) and one KCSFile output. I need this to return every time, regardless of if it is the same file.
Outputs:
02c5040b-b9fe-49b8-b40c-62cd3559fcd2
02c5040b-b9fe-49b8-b40c-62cd3559fcd2
<KCSFile: 0x7fedb8da49d0>
Hi Elijah,
The error that these functions would throw when downloading the duplicate files is "Download already in progress.". So if you capture all the file id's for which this error occured and then retry downloading only these files again once the initial transfer is done, you should get the respective KCSFile objects filled in (and they would come from the cache).
Thanks,
Pranav
Kinvey Support
- Oldest First
- Popular
- Newest First
Sorted by PopularPranav J
Hi Elijah,
The error that these functions would throw when downloading the duplicate files is "Download already in progress.". So if you capture all the file id's for which this error occured and then retry downloading only these files again once the initial transfer is done, you should get the respective KCSFile objects filled in (and they would come from the cache).
Thanks,
Pranav
Kinvey Support
Pranav J
Hi Elijah,
Can you let me know the error that you see in the completion block handler?
When you are fetching the ID's would it be possible to send back only distinct id's?
If you could provide additional information about the scenario as to how you are ending up with duplicate id's (any more code snippets would also do) that will enable to help better.
Thanks,
Pranav
Kinvey Support
Elijah
Essentially I want to fetch a profile picture from a user relation–but duplicate IDs (of the user or their picture) only results in KCSFileStore fetching one object.
Here is the custom Post object (simplified):
Let's assume I fetch all posts and users with a function and pass them in a completion block. All of the posts and users have distinct pointer addresses, and this works fine. However, when I try to fetch the profile pictures from each user, if a user is repeated, only one profile picture is fetched. I have tried KCSFileStore.downloadData and .downloadFile.
Elijah
I just want downloadData/downloadFile to return a picture.localURL or .remoteURL regardless of any conditions.
-
Why do I get "Undefined symbols" errors when building with KinveyKit?
-
How do I register push tokens?
-
When using social login, to perform a log-out, do I need to log out of the social network, Kinvey, o
-
How can I assign additional properties to users?
-
Does KinveyKit support 64-bit ARM devices, such as iPhone 5s?
-
Authorization Token Invalid or Expired
-
BOOL and how it is stored in the database.
-
Offline saving throwing errors
-
Custom endpoint not able to form request object
-
Security through business logic
See all 437 topics