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.
down casting user to customUser after user query to obtain an attribute
b
bkwart
started a topic
about 6 years ago
I am trying to look up a use through the user query method and then downcast the user to CustomUser to be able to retrieve the profilePicId in CustomUser collection but it does not seem to work.Below is my code
func getHostProfilePicId(username : String){
if let user = Kinvey.sharedClient.activeUser{
let userQuery = UserQuery{
$0.username = email
}
user.lookup(userQuery) {
if let users = users {
let foundUser = users[0] as? CustomUser
print(foundUser?,profilePicId)
}
}
}
}
From the code above I proceed to print (foundUser?.profilePicId) but I get nil.Same with foundUser.I do get a user at array index 0 but the downcast is not working.How do i go about this?
}
Best Answer
B
Billy Gee
said
about 6 years ago
Hello Bkwart,
We are pleased to inform you that a new release of the iOS SDK v3.5.0 has been posted and is available for download at the following location.
bkwart
I am trying to look up a use through the user query method and then downcast the user to CustomUser to be able to retrieve the profilePicId in CustomUser collection but it does not seem to work.Below is my code
func getHostProfilePicId(username : String){
if let user = Kinvey.sharedClient.activeUser{
let userQuery = UserQuery{
$0.username = email
}
user.lookup(userQuery) {
if let users = users {
let foundUser = users[0] as? CustomUser
print(foundUser?,profilePicId)
}
}
}
}
From the code above I proceed to print (foundUser?.profilePicId) but I get nil.Same with foundUser.I do get a user at array index 0 but the downcast is not working.How do i go about this?
}
Hello Bkwart,
We are pleased to inform you that a new release of the iOS SDK v3.5.0 has been posted and is available for download at the following location.
http://devcenter.kinvey.com/ios/downloads
This update fixes the problem described in this ticket regarding downcasting problem.
At your convenience, please download and test the fix and let us know if it works to your satisfaction.
Regards,
Billy Gee
- Oldest First
- Popular
- Newest First
Sorted by Newest FirstBilly Gee
Hello Bkwart,
We are pleased to inform you that a new release of the iOS SDK v3.5.0 has been posted and is available for download at the following location.
http://devcenter.kinvey.com/ios/downloads
This update fixes the problem described in this ticket regarding downcasting problem.
At your convenience, please download and test the fix and let us know if it works to your satisfaction.
Regards,
Billy Gee
Pranav J
Bkwart,
This has been escalated to engineering. I will update you once I have more information from engineering.
Thanks,
Pranav
Kinvey
MLIBZ-1770
Pranav J
Bkwart,
Check spelling of "profilePicId" in your mapping function. I assume this might be because of the spellchecker. You have written "profilePidId".
Thanks,
Pranav
Kinvey
bkwart
1. I am storing it as a string
2 class CustomUser: User{
var profilePicId : String?
var firstName : String?
var lastName : String?
override fun mapping(map : Map){
super.mapping(map: map)
profilePidId <- map["profilePidId"]
firstName <- map["firstName"]
lastName <- map["lastName"]
}
}
3. SDK v3.3.8,
Pranav J
Thanks,
Pranav
Kinvey
-
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