iOS app restarting instead of resuming

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
mousou2003@yahoo.com
Posts: 3
Joined: Sun Jan 29, 2012 11:59 pm

iOS app restarting instead of resuming

Post by mousou2003@yahoo.com » Mon Jan 30, 2012 12:13 am

Hello,

I have done a small app that run on iOS using LiveCode 5.0.2, XCode 4.2 on OSX Snow Leopard.
The app works great! But, when I switch app back and forth on My iPad (iOS 5.0.1) the App is restarting. I would expect the app to resume to the same state.
Does anyone understand why this is happening?

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: iOS app restarting instead of resuming

Post by Mark » Mon Jan 30, 2012 11:15 am

Hi,

I would expect that too, but RunRev decided otherwise. I believe that reason is that LiveCode apps crash on resume.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm

Re: iOS app restarting instead of resuming

Post by gpb01 » Mon Jan 30, 2012 1:35 pm

Quite easy to implement ...
... just save somewhere your program environment 'on shutDown' and restore when your program start ;)

Guglielmo

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: iOS app restarting instead of resuming

Post by Mark » Mon Jan 30, 2012 2:02 pm

Hi Guglielmo,

I agree partly. The problem is that 1) it would be so much easier if LiveCode did this by itself and 2) sometimes the user might want to restart the app but there wouldn't be any different between a "resume" and an actual restart.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm

Re: iOS app restarting instead of resuming

Post by gpb01 » Mon Jan 30, 2012 2:52 pm

Mark wrote:Hi Guglielmo,
I agree partly. The problem is that 1) it would be so much easier if LiveCode did this by itself and 2) sometimes the user might want to restart the app but there wouldn't be any different between a "resume" and an actual restart.
Kind regards,

Mark
Hi Mark,

I totally agree on point (1) :D , but I don't understand your point (2) ...
...if you want a 'resume' situation, just save where exactly you are and, when the program restart, you go where you have been stopped, otherwise, just 'restart' and discard the saved situation.

Guglielmo

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: iOS app restarting instead of resuming

Post by Mark » Mon Jan 30, 2012 3:01 pm

Hi Guglielmo,

There is no way for the app (or the programmer) to know whether the app restarts because the user wants it to "resume" or because the user wants it to actually restart.

In other words, there is no way to know whether the user double-pressed the Home button and navigated to a different app or double-pressed the Home button, tapped-and-held the app icon until the delete badge appeared and tapped the delete badge to stop the app and then started the app again from the Home screen.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm

Re: iOS app restarting instead of resuming

Post by gpb01 » Mon Jan 30, 2012 3:22 pm

Mark wrote:Hi Guglielmo,
There is no way for the app (or the programmer) to know whether the app restarts because the user wants it to "resume" or because the user wants it to actually restart.

In other words, there is no way to know whether the user double-pressed the Home button and navigated to a different app or double-pressed the Home button, tapped-and-held the app icon until the delete badge appeared and tapped the delete badge to stop the app and then started the app again from the Home screen.

Kind regards,
Mark
Hi Mark,
... ok, now I understand what you mean ... and yes, you right, unfortunately there is no way to know ... :(

Regards,

Guglielmo

mousou2003@yahoo.com
Posts: 3
Joined: Sun Jan 29, 2012 11:59 pm

Re: iOS app restarting instead of resuming

Post by mousou2003@yahoo.com » Tue Jan 31, 2012 5:11 am

Is this behavior compliant with Apple guidelines? There is a big document on Apple web site that tells you what is expected - and honestly I did not read all.
I wouldn't want my App to be rejected.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: iOS app restarting instead of resuming

Post by Mark » Tue Jan 31, 2012 5:52 pm

Hi,

It is not a reason to reject your app.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

semiplay
Posts: 13
Joined: Tue Mar 18, 2008 7:32 pm

Re: iOS app restarting instead of resuming

Post by semiplay » Tue Aug 14, 2012 2:19 am

If anyone is interested, I have found a solution that works in the simulator for iOS so far.

I looked at the specialFolderPath info, and both temp and cache seem to stick around only for the duration of the app. The effect is that if I use the home button to leave the app, then come back, it goes to the card I was on. If I double click and actually quit the app from the bottom menu, then start it again, it starts on card 1.

Hopefully it's helpful.

==============================================

--Here is what I added to the main stack script:

on openStack
set the defaultFolder to specialFolderPath("cache")
put URL ("file:iphonetest.txt") into myCard
if myCard is not empty then
go card myCard
end if
end openStack

on shutdown
set the defaultFolder to specialFolderPath("cache")
put the number of the current card into URL ("file:iphonetest.txt")
end shutdown

Post Reply