Showing EULA when app starts and quiting if user doesn't accept it

为君一笑 提交于 2019-12-22 08:29:27

问题


I must show EULA on the first launch. I want to close the app if user doesn't accept it. What is the proper way to do it so that the app will be accepted to app store? I read that using exit(0) and [[UIApplication sharedApplication] terminate] is not the way to go.


回答1:


Apple doesn't want you to exit the app because it looks like a crash. That is why they made -[UIApplication terminate] private and will reject your app if you use it. They don't seem to reject apps that use exit and I've seen apps exit themselves but I agree with Apple that it's not good UI behavior on iOS, it does indeed feel strange if you get thrown back to the home screen without having pressed the home button. So I recommend you simply show a screen with a message along the lines of "You cannot use the app without accepting the EULA. Either accept the EULA or press the Home button".




回答2:


You can suspend the app and it gives the appearance that the app is closing.

UIApplication *app = [UIApplication sharedApplication]; 
[app performSelector:@selector(suspend)];


来源:https://stackoverflow.com/questions/5894228/showing-eula-when-app-starts-and-quiting-if-user-doesnt-accept-it

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!