Search code examples
iosobjective-cquickblox

How to create a temporary User in QuickBlox?


I was wandering the best way to create a user and delete it after session ends. I'm tring to make a Annonymous chat. The app create and random login and password, sign up the user and log it in. When the user closes the app (double press home and swipe up) it should delete the user.

Where should i put the [QBUsers deleteUserWithID:userID delegate:self]; code ?

I've tried in applicationWillTerminate:

- (void)applicationWillTerminate:(UIApplication *)application {
    [QBUsers deleteUserWithID:appDelegate.appUser.userID delegate:self];
    NSLog(@"%u",appDelegate.appUser.userID);  
}

The NSLog return the right ID, but the user don't get deleted, if i put a IBAction with the same code it works.

Any Ideas ?


Solution

  • The issue with your code is that you can perform only sync code in applicationWillTerminate, but not async.