am trying to get the current user’s token after setting the stayloggedin as true but i am not able to understand this doc https://backendless.com/documentation/users/ios/users_login.htm the examples for getting user’s token is in ObjC and am not into ObjC can any one please explain me how to get the current user’s token for avoiding logging every time app starts
thanks
There was an error in the docs preventing that specific Swift example from showing. It is fixed now.
hey mark,
thanks again for your active support like always
Hello, Mark
How are you?
I am trying backendless sign up and login function now.
But I have failed.
the error is “HttpEngine: INVALID statusCode 401”
Could you do help me?
Hello, Mark
How are you?
I am trying backendless sign up and login function now.
But I have failed.
the error is “HttpEngine: INVALID statusCode 401”
Could you do help me?
Hi Andrei
Create a separate support topic for this issue. This topic is not related to developer’s login and has been closed about a year ago.
Hi Andrei,
Please open a new support topic. The question you’re asking is not related to the topic it is in.
Regards,
Mark
Hello, Mark
Thanks!
I have just solved the problem.
But, I have the other problem now.
I can’t get all friends’s backendlessUser from backendless server.
following code is my some code.
let whereClause = “userOneId = ‘(backendless!.userService.currentUser.objectId!)’”
let dataQuery = DataQueryBuilder()
dataQuery?.setWhereClause(whereClause)
dataStore!.find(dataQuery, response: { (friends_) in
if friends_ != nil {
let friends = friends_! as! [Friend]
self.friendObjects = friends
for friend in friends {
print("Current user is \(String(describing: backendless!.userService.currentUser.objectId!))")
print("friends user is \(String(describing: friend.objectId))")
print("friends user is \(String(describing: friend.userOneId))")
self.friends.append(friend.userTwo!)
self.friendId.append(friend.userTwo!.objectId as String)
}
self.tableView.reloadData()
if self.friends.count == 0 {
ProgressHUD.showError("Currently you have no friends")
}
}
}) { (fault) in
print("Couldnt load friends: \(fault!.detail)")
}
next code is the save code snippet.
class Friend: NSObject {
var objectId: String?
var userOneId: String?
var userTwo: BackendlessUser?
}
func saveFriend(selectedFriend: BackendlessUser) {
if friendId.contains(selectedFriend.objectId as String) {
return
}
let friend = Friend()
friend.userOneId = backendless!.userService.currentUser.objectId as String
friend.userTwo = selectedFriend
dataStore!.save(friend, response: { (result) in
self.loadFriends()
}) { (fault) in
ProgressHUD.showError("Error saving friend:\(fault!.detail)")
}
}
Would you please just help me?
Regards
Andrei
Please create a separate topic in this support forum.
Thanks,
Mark