close app with button

Hello everybody


I cannot find a way to close the app with a button


I believe this is very easy to do, but due to my lack of experience with xcode and swift, I am not sure of how to do this


thanks in advance!


May the Force be with you

Replies

I don't think you can close an app with, perhaps, the exception of causing a crash.


So, if you must, place a piece of code that will crash the app in an IBAction that is called by the button.

What platform is the app for? iOS, macOS or other?

If you're talking about an iOS app, closing an app other than using the Home button is against the Human Interface Guidelines (HIG) and may result in your app being rejected.

I thought about that, could work...


do you know some code that would work?


May the Force be with you

iOS, because I am not sure of how to do it in macs


May the Force be with you

that is an important information for me, thanks!


I will take a look into the human interface guidelines, for sure


but when you said about rejection, exactle who would reject? AppStore? the users?



May the Force be with you

You really have to ask yourself, why are you doing this?????


//here is the crash that just happened to me.  

    NSString *anyString=[@"length is 12" substringFromIndex:13];
    

The App Store -- there have been discussions on here of apps being rejected by Apple for that reason.