以编程方式暂停/关闭应用程序
如何以编程方式暂停/关闭我的 iPad 应用程序?我想在应用程序启动时显示使用条款。如果用户按下接受按钮,应用程序应该继续。如果用户按下“拒绝”按钮,则应用程序应暂停/关闭。
PS:该应用程序是使用 Titanium Appcelerator 框架构建的。
How can I suspend/close my iPad app programmatically? I wanted to show the terms of use on app start up. If user presses the Accept button the app should continue. If user presses the Decline button the app should be suspended/closed.
PS : The app is built using Titanium Appcelerator framework.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你可以尝试调用 exit() 但是,说实话,我怀疑你想要的行为是可取的。我还没有看到任何其他应用程序这样做 - 我不确定苹果是否会接受它。
you could try calling exit() but, to be honest, i doubt that the behaviour you want is desirable. i haven't seen any other apps do it - i'm not sure it'd be considered acceptable by Apple.
您永远不会退出 iPhone 或 iPad 应用程序。
如果确实如此,苹果会将其视为崩溃并肯定会拒绝您的应用程序。
对于您的情况,最好的解决方案是显示另一个屏幕,其中显示一条消息,例如:“在接受条款之前,您无法访问该应用程序”或类似的内容。
You never exit from an iPhone or iPad application.
If it does apple takes it as a crash and surely reject your application.
In your case, the best solution will be displaying another screen which display a message like: "You cannot access the application until you accept the terms" or something like that.
您可以使用
exit(0)
;每当您想退出应用程序时。我已经在我的项目中实现了这段代码,它对我来说工作得很好。You can use
exit(0)
; whenever you want to exit the app. I have implemented this code in my project and it works perfectly fine for me.