ios - 如何在 QuickBlox 中创建临时用户?
<p><p>我正在寻找创建用户并在 session 结束后将其删除的最佳方法。我正在尝试进行匿名聊天。应用程序创建和随机登录名和密码,注册用户并登录。当用户关闭应用程序(双击主页并向上滑动)它应该删除用户。</p>
<p>我应该把 放在哪里;代码?</p>
<p>我已经在 applicationWillTerminate 中尝试过:</p>
<pre><code>- (void)applicationWillTerminate:(UIApplication *)application {
;
NSLog(@"%u",appDelegate.appUser.userID);
}
</code></pre>
<p>NSLog 返回正确的 ID,但用户不会被删除,如果我使用相同的代码放置 IBAction 即可。</p>
<p>有什么想法吗?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>文档是这样说的:</p>
<blockquote>
<p>(...) you must be prepared for your app <strong>to be killed without any
notification</strong>. The user can kill apps explicitly using the
multitasking UI.</p>
</blockquote>
<p>还有一些关于 <code>applicationWillTerminate 的更多信息:</code></p>
<blockquote>
<p>If your app is running at termination time, the system calls your app
delegate’s <code>applicationWillTerminate:</code> method so that you can perform
any required cleanup. Your method has approximately 5 seconds to
perform any tasks and return. If it does not return in time, the app
is killed and removed from memory.</p>
<p><strong>Important</strong>: The <code>applicationWillTerminate:</code> method is not called if your
app is currently suspended.</p>
</blockquote>
<p>来源:<a href="https://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html#//apple_ref/doc/uid/TP40007072-CH4-SW1" rel="noreferrer noopener nofollow">App States and Multitasking</a> </p></p>
<p style="font-size: 20px;">关于ios - 如何在 QuickBlox 中创建临时用户?,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/24964672/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/24964672/
</a>
</p>
页:
[1]