Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-11-2011, 02:02 AM   #1 (permalink)
Registered Member
 
Join Date: Aug 2011
Location: Lahore, Pakistan
Posts: 3
AasimNaseem is on a distinguished road
Default Termination of Application

We can terminate our application using exit(0) or [[UIApplication sharedApplication] terminate];
I just want to confirm that is this a recommended approach? Like I heard someone was saying Apple may reject your application if there is a case of suicide in your app; (:

Kindly guide;

Regards
AasimNaseem is offline   Reply With Quote
Old 08-11-2011, 02:06 AM   #2 (permalink)
Rko
Registered Member
 
Join Date: Jun 2010
Posts: 63
Rko is on a distinguished road
Default

Apple will surely reject if u use exit(0). Talking outta experience

Not sure of the rejection policy for ur second option.
Rko is offline   Reply With Quote
Old 08-11-2011, 02:06 AM   #3 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

The only thing recommended when it comes to terminating through code is to not do it. Cases are rare where it's warranted and you may get rejected if it's not. But exit(0) should be fine.
baja_yu is offline   Reply With Quote
Old 08-11-2011, 02:13 AM   #4 (permalink)
Rko
Registered Member
 
Join Date: Jun 2010
Posts: 63
Rko is on a distinguished road
Default

If you do not want your application to remain in the background when it is quit, you can explicitly opt out of the background execution model by adding the UIApplicationExitsOnSuspend key to your application’s Info.plist file and setting its value to YES.
When an application opts out, it cycles between the not-running, inactive, and active states and never enters the background or suspended states. When the user taps the Home button to quit the application, the applicationWillTerminate: method of the application delegate is called and the application has approximately 5 seconds to clean up and exit before it is terminated and moved back to the not-running state.

Hope this helps..
Rko is offline   Reply With Quote
Old 08-11-2011, 02:29 AM   #5 (permalink)
Registered Member
 
Join Date: Aug 2011
Location: Lahore, Pakistan
Posts: 3
AasimNaseem is on a distinguished road
Default

Thats seems great;
So its means using exit(0) has chances of rejection from Apple?

Infact i got a project for code review and I found exit(0) at two three places in code; So I want to make sure this thing before suggesting my client about possible work arounds;
AasimNaseem is offline   Reply With Quote
Old 08-11-2011, 02:36 AM   #6 (permalink)
Rko
Registered Member
 
Join Date: Jun 2010
Posts: 63
Rko is on a distinguished road
Default

Quote:
Originally Posted by AasimNaseem View Post
Thats seems great;
So its means using exit(0) has chances of rejection from Apple?

Infact i got a project for code review and I found exit(0) at two three places in code; So I want to make sure this thing before suggesting my client about possible work arounds;
exit(0) is a big NO NO by Apple.
Check this out about terminating apps in Apple's iOS Human Interface Guidelines

Don’t Quit Programmatically

Never quit an iOS application programmatically because people tend to interpret this as a crash. However, if external circumstances prevent your application from functioning as intended, you need to tell your users about the situation and explain what they can do about it. Depending on how severe the application malfunction is, you have two choices.

Display an attractive screen that describes the problem and suggests a correction. A screen provides feedback that reassures users that there’s nothing wrong with your application. It puts users in control, letting them decide whether they want to take corrective action and continue using your application or press the Home button and open a different application

If only some of your application's features are not working, display either a screen or an alert when people activate the feature. Display the alert only when people try to access the feature that isn’t functioning.
Rko is offline   Reply With Quote
Old 08-11-2011, 02:39 AM   #7 (permalink)
Registered Member
 
Join Date: Aug 2011
Location: Lahore, Pakistan
Posts: 3
AasimNaseem is on a distinguished road
Default

@Rko

you made my day; This is what i need; Ten on ten dear;
AasimNaseem is offline   Reply With Quote
Old 08-11-2011, 05:55 PM   #8 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

Just to reiterate, it depends on the situation. I've got several apps into the store that do it. The case is the initial EULA screen with agree/decline buttons, the latter of which would terminate using exit(). Though I don't like the approach personally, especially since App Store provides a way to add an additional EULA if needed.
baja_yu is offline   Reply With Quote
Old 08-13-2011, 08:09 AM   #9 (permalink)
Rko
Registered Member
 
Join Date: Jun 2010
Posts: 63
Rko is on a distinguished road
Default EULA

Quote:
Originally Posted by baja_yu View Post
Just to reiterate, it depends on the situation. I've got several apps into the store that do it. The case is the initial EULA screen with agree/decline buttons, the latter of which would terminate using exit(). Though I don't like the approach personally, especially since App Store provides a way to add an additional EULA if needed.
Additional EULA eh...
Could you please give me more details on this one... wud like to get as much possible details on EULA as possible.. It would be great if you could help me with this...

- RKO
Rko is offline   Reply With Quote
Reply

Bookmarks

Tags
iphone, terminate, xcode

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 400
15 members and 385 guests
7twenty7, blasterbr, chiataytuday, cristofercolmbos, dedeys78, dre, fiftysixty, gmarro, HemiMG, jimmyon122, jonathandeknudt, pungs, raymng, tymex, UMAD
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,669
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, dedeys78
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:07 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0