Timer not working on iPad

Want to talk about something that isn't covered by another category?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Timer not working on iPad

Post by ctflatt » Tue Oct 26, 2010 8:36 pm

I have built a demo stack prototype and have included a timer which functions as a clock.

The stack tests fine in the iPhone Simulator, but when deployed is frozen at the time the stack was last saved.

Should this be working? Is this a supported feature in the Mobile prerelease? I read the revision 8 user guide, and looked for "What Works" and "What Doesn't Work" and couldn't find an answer.

Here's what I have in the first card of the stack:

on openCard
--set the label of field "todaysDate" to the long system date

put the long system date into field "todaysDate"

--set the label of field "clock" to the long system time

set the timerFlag of this stack to true
  startTimer
pass openCard

end openCard

--Timer function to control the reader clock

on startTimer
  put the long time into fld "clock"
  if the timerFlag of this stack then send startTimer to me in 1 second
end startTimer

on closeCard
  set the timerFlag of this stack to false
  repeat for each line theLine in the pendingmessages
  if "startTimer" is in theLine then cancel item 1 of theLine
end repeat
  pass closeCard
end closeCard

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4171
Joined: Sun Jan 07, 2007 9:12 pm

Re: Timer not working on iPad

Post by bn » Tue Oct 26, 2010 9:26 pm

Hi ctflatt,
your script works for me out of the box, no change necessary. It works both on the iPad and an iPhone 3G iOS 4.1

Is something trapping the opencard message?

regards
Bernd

ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Re: Timer not working on iPad

Post by ctflatt » Tue Oct 26, 2010 9:49 pm

Bernd:

Thanks for the quick response.

If you don't mind looking, I have attached the stack.

I am using animationEngine 3 in the stack, and I can get it to work in the simulator, but not the actual device.

What am I missing?

Thanks for checking...
Attachments
protoype.zip
My prototype stack.
(192.82 KiB) Downloaded 382 times

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4171
Joined: Sun Jan 07, 2007 9:12 pm

Re: Timer not working on iPad

Post by bn » Wed Oct 27, 2010 12:05 am

ctflatt,
that is weird. As you noticed your app did not work on the iPad.
So I wondered why my code works, which is what I copy pasted from your post. The copied script worked in your iPad app, when I pasted it into the script of card main.
But the text was exactly the same. Why did your script not work and mine did?
I copied your script to a texteditor that showed invisible characters and there were what chartoNum showed as ascii 202. And that was not in my copied code from the internet.

The question is, where did that come from? Did it get lost in passing through the forum post? Why does it work in the IDE and not on the iPad.

I am puzzled

I post here the code that worked when I put it into the script of your card "main"

Code: Select all

on openCard
   --set the label of field "todaysDate" to the long system date
   
   put the long system date into field "todaysDate"
   
   --set the label of field "clock" to the long system time
   
   set the timerFlag of this stack to true
   startTimer
   pass openCard
   
end openCard

--Timer function to control the reader clock

on startTimer
   put the long time into fld "clock"
   if the timerFlag of this stack then send startTimer to me in 1 second
end startTimer

on closeCard
   set the timerFlag of this stack to false
   repeat for each line theLine in the pendingMessages
      if "startTimer" is in theLine then cancel item 1 of theLine
   end repeat
   pass closeCard
end closeCard
As you can see it is word by word the same as is in your project. Would you mind trying this code and telling if it works for you?

Ascii 202 seems to be a eacute or circonflex, depending what encoding you use. The high ascii characters differ between the asciis. Are you on a Mac or Linux or Windows?

anyway, ascii 202 baffles science...

regards

Bernd

ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Re: Timer not working on iPad

Post by ctflatt » Wed Oct 27, 2010 10:23 am

Bernd:

Thanks so much for checking this out for me.

Unfortunately, copying and pasting your code again did not work on the iPad.

I did manage to get it to work by completely rekeying the script. This is something I would not have done, if your post had not mentioned the ascii issue.

I have no idea what happened on the first attempt.

I am using a MacBook Pro.

Thanks, again, for your input. I really appreciate it!

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4171
Joined: Sun Jan 07, 2007 9:12 pm

Re: Timer not working on iPad

Post by bn » Wed Oct 27, 2010 10:48 am

ctFlatt,
I used TextWrangler to display the invisible characters. TextWrangler is a free App from BareBones. You might want to get it to have a look at the text for stuff like this. It also has the option to "convert to ascii" which removes the stray stuff.

Did you edit the script in any other program text editor before putting it into the script of the main card?

What worries me is that as long as you dont know how ASCII 202 got into the script it is very difficult to debug something. If it does not work on the iPad but in the IDE. There are enough issues with the current preAlpha version that one has to take into account that stray characters is one thing one would not like to have to worry about.

Please try to think again about how these ASCII 202 could have gotten in there. An answer to this would be reassuring.

by the way: your layout looks very good. And Rev got their first App built with RevMobile accepted in the AppStore, in case you did not know it already.

http://www.runrev.com/company/runrev-blog/

regards

Bernd

ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Re: Timer not working on iPad

Post by ctflatt » Wed Oct 27, 2010 8:17 pm

Bernd:

Thanks, again, for checking into this for me!

I actually got the script from this forum:

http://forums.runrev.com/phpBB2/viewtop ... lock#p1350

I copied the code from this entry and pasted. I have TextWrangler, but didn't think to check for hidden characters.

I just thought it was strange that it runs in the IDE and the Simulator, but not on the actual device.

Your insight into hidden characters prompted me to clear the original script and re-key it from scratch, which DID work on the device.

I'm stumped, unless copying the code from the forum brought those characters in.

I hope this helps.

:Todd

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4171
Joined: Sun Jan 07, 2007 9:12 pm

Re: Timer not working on iPad

Post by bn » Wed Oct 27, 2010 8:28 pm

Todd,
sorry to be insisting. I copied the script from the post and it has no ascii 202 in it.

Do you use your Mac in foreign language settings, like right to left languages or chinese etc. Just a guess that the clipboard could switch to some complex unicode and Rev does not get it.
BTW. I did send this to support at Rev. Just to let them know. Not as a bug report. My point was that at least they should know that Revmobile behaves differently in the IDE than on the actual device. And maybe someone can come up with an explanation for the different behavior. They probably will not know where the stray characters come from.

regards
Bernd

ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Re: Timer not working on iPad

Post by ctflatt » Wed Oct 27, 2010 9:08 pm

Bernd:

I just got repeatable results...

1) I copied your script from the forum to the clipboard
2) I pasted it into a card in a new stack
3) I then copied the script from the script editor to the clipboard
4) Then pasted it into TextWrangler

It seems the strange characters (which happen at indents, tabs?) is introduced when copying the script FROM the Rev script editor?

Can you repeat this to verify?

:Todd

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4171
Joined: Sun Jan 07, 2007 9:12 pm

Re: Timer not working on iPad

Post by bn » Wed Oct 27, 2010 10:05 pm

Todd,
I can confirm that. Also that in Rev 4.0 it does _not_ happen. I tried in 4.5 and the DPs, there it is.
I dont know if something was changed in the script editor or what. No ascii 202 when typing and formatting the script editor manually in the 4.5 series, just when pasting.?
Funny thing is that I tried with the bareBones stack I did initially and pasted the coder there and it worked in 4.5 even with 202's in it. Have to try a couple of combinations yet.
What version are you using?
In case you have Rev 4.0 also could you try to build your iPad app with that version. I am using RevMobile PreAlpha 10

regards
Bernd

ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Re: Timer not working on iPad

Post by ctflatt » Wed Oct 27, 2010 10:11 pm

Bernd:

I will try a few combinations, too... I have several Rev versions on my system.

This project was done in 4.5 Build 1080, with RevMobile PreAlpha 4.0.0-pre-alpha-10.

Did we find a bug?

Sorry to bother you with this, but very thankful for the insights!

:Todd

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4171
Joined: Sun Jan 07, 2007 9:12 pm

Re: Timer not working on iPad

Post by bn » Fri Oct 29, 2010 6:57 pm

Todd,

Runrev informed me that they put the issue into their internal bug database. So no number to look at in
http://quality.runrev.com/qacenter/
They provided no further details.

It really might be a bug.
did not investigate further.
regards
Bernd

Post Reply