Advertisement
Guest User

Untitled

a guest
Mar 18th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.31 KB | None | 0 0
  1. func getIndex() {
  2.  
  3. self.backendless.userService.getPersistentUser()
  4. let user = self.backendless.userService.currentUser
  5.  
  6.  
  7. var dataStore = backendless.data.of(Groups.ofClass())
  8. dataStore.findID(
  9. "B52F6BEA-79F8-A58B-FF15-AF840BCB2A00",
  10. response: { (result: AnyObject!) -> Void in
  11. var LookingForGroupJoining = result as! Groups
  12. // LookingForGroupJoining.UsersInGroup.append(user)
  13. let index = LookingForGroupJoining.UsersInGroup.indexOf(user)
  14. print("This is the index number : (index)")
  15. print("This is the user : (user)")
  16. print("These are all the values of the UsersInGroup : (LookingForGroupJoining.UsersInGroup)")
  17.  
  18.  
  19. dataStore.save(
  20. LookingForGroupJoining,
  21. response: { (result: AnyObject!) -> Void in
  22. let GroupJoining = result as! Groups
  23. print("Group has been saved: (GroupJoining.groupName)")
  24.  
  25. },
  26. error: { (fault: Fault!) -> Void in
  27. print("Server reported an error (1): (fault)")
  28. })
  29.  
  30.  
  31. print("Group has been found: (LookingForGroupJoining.objectId)")
  32. },
  33. error: { (fault: Fault!) -> Void in
  34. print("Server reported an error (2): (fault)")
  35. })
  36. }
  37.  
  38. This is the index number : nil
  39. This is the user : <BackendlessUser> {
  40. "__meta" = "{"relationRemovalIds":{},"selectedProperties":["__updated__meta","password","created","name","___class","ownerId","updated","objectId","email"],"relatedObjects":{}}";
  41. created = "2016-03-07 06:06:40 +0000";
  42. email = "test@test.com";
  43. lastLogin = "2016-03-11 04:30:01 +0000";
  44. name = "<null>";
  45. objectId = "4A955ADD-7991-1AF8-FFEF-3754587B2300";
  46. ownerId = "<null>";
  47. updated = "<null>";
  48. "user-token" = "18C87E0E-2BB3-DB1D-FF63-3CD5FE003200";
  49. }
  50. These are all the values of the UsersInGroup : [<BackendlessUser> {
  51. "___class" = Users;
  52. created = "2016-03-07 03:45:05 +0000";
  53. email = "lekan.adeyeri@gmail.com";
  54. name = test;
  55. objectId = "0EB97FF9-FBF1-2E7E-FF30-160BB6CFFC00";
  56. ownerId = "<null>";
  57. password = "<null>";
  58. updated = "2016-03-18 22:33:02 +0000";
  59. }, <BackendlessUser> {
  60. "___class" = Users;
  61. created = "2016-03-07 06:06:40 +0000";
  62. email = "test@test.com";
  63. name = "<null>";
  64. objectId = "4A955ADD-7991-1AF8-FFEF-3754587B2300";
  65. ownerId = "<null>";
  66. password = "<null>";
  67. updated = "2016-03-18 22:33:02 +0000";
  68. }, <BackendlessUser> {
  69. "___class" = Users;
  70. created = "2016-03-06 04:15:27 +0000";
  71. email = "tesbhjbj@ttt.tyy";
  72. name = "<null>";
  73. objectId = "570CD92B-74EB-1325-FF8F-B866CB6CB400";
  74. ownerId = "<null>";
  75. password = "<null>";
  76. updated = "2016-03-18 22:33:02 +0000";
  77. }, <BackendlessUser> {
  78. "___class" = Users;
  79. created = "2016-03-05 04:50:14 +0000";
  80. email = "test@testmail.test";
  81. name = test;
  82. objectId = "A0831585-716E-B027-FF37-539497748400";
  83. ownerId = "<null>";
  84. password = "<null>";
  85. updated = "2016-03-18 22:33:02 +0000";
  86. }, <BackendlessUser> {
  87. "___class" = Users;
  88. created = "2016-03-05 14:54:53 +0000";
  89. email = "test1@testmail.test";
  90. name = test;
  91. objectId = "C8A47476-E5D2-B84D-FF5A-2EB605040400";
  92. ownerId = "<null>";
  93. password = "<null>";
  94. updated = "2016-03-18 22:33:02 +0000";
  95. }]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement