let query = BackendlessDataQuery()
query.whereClause = "fromUser.objectId = '\(backendless.userService.currentUser.objectId)' AND toUser.objectId = '\(searchUserId)' AND type = 'follow'"
let activityStore = backendless.data.of(Activity.ofClass())
// now delete the saved object
activityStore.remove(
query,
response: { (result: AnyObject!) -> Void in
print("Contact has been deleted: \(result)")
},
error: { (fault: Fault!) -> Void in
print("Server reported an error (2): \(fault)")
})
Ok I get what you mean am i doing correct cause i am getting this error
FAULT = ‘2024’ [Wrong entity name: name must not have a symbol ‘.’] <Wrong entity name: name must not have a symbol ‘.’>
let query = BackendlessDataQuery()
query.whereClause = "fromUser.objectId = '\(backendless.userService.currentUser.objectId)' AND toUser.objectId = '\(searchUserId)' AND type = 'follow'"
Types.tryblock({ () -> Void in
let users = backendless.persistenceService.of(Activity.ofClass()).find(query)
let currentPage = users.getCurrentPage()
for test in currentPage as! [Activity] {
delete = test.objectId!
}
print("Loaded \(currentPage.count) USers objects")
print("Total Follow users in the Backendless starage - \(users.totalObjects)")
},
catchblock: { (exception) -> Void in
print("Server reported an error: \(exception as! Fault)")
}
)
let activityStore = backendless.data.of(Activity.ofClass())
// now delete the saved object
activityStore.remove(
delete,
response: { (result: AnyObject!) -> Void in
print("Contact has been deleted: \(result)")
},
error: { (fault: Fault!) -> Void in
print("Server reported an error (2): \(fault)")
})
Server reported an error (2): FAULT = ‘1033’ [Unable to remove object. Object with the specified primary key does not exist] <Unable to remove object. Object with the specified primary key does not exist>
Activity Class
class Activity : NSObject {
var fromUser : BackendlessUser?
var toUser : BackendlessUser?
var type : String?
var objectId : String?
var created : NSDate?
var updated : NSDate?
var ownerId : String?
}