Antonio
Antonio

Reputation: 535

iPhone: Quitting aplication using [[UIApplication sharedApplication] terminateWithSuccess];

I have built a small app that gets informations from a database on a website. the first thing the app does is to fetch an rss feed and then display it.

Apple guidelines tell to let the user decide if he/she wants to connect to the Internet, so I have placed an alert at the beginning showing "The app will connect to the Internet. Continue?" with two buttons: "Yes", and "No, quit"

if the user chooses "No, Quit", then I call:

[[UIApplication sharedApplication] terminateWithSuccess];

It Works. But I have read that Apple disencourage that, (Not an official API???) and that the only way to terminate an app should be the use of the Home button.

I tried an alernative: if the user press "No, Quit" I simply show a label that says "Quit the app using the Home Button"...

So, what should I do? leave the alert and quit the app or just show the "please quit" label???

Upvotes: 0

Views: 2761

Answers (2)

hotpaw2
hotpaw2

Reputation: 70703

Just leave off the "No" button.

Either the user will hit "Yes" and connect, or the user will terminate (or background) your app by switching to another app, since they have no other choice.

App termination by simply forcing the user to do something reasonable.

Upvotes: 0

DarkDust
DarkDust

Reputation: 92335

You may never actively terminate your app, otherwise Apple will reject the app (I know by experience ;-). Only thing you can do is show a dialog, e.g. a UIAlertView without any buttons, asking the user to quit via home button.

But I never heard about the guidelines you've cited regarding an Internet connection. Please give a link. I've worked on a lot of apps that connect to the Internet without asking and Apple never complained.

Upvotes: 1

Related Questions