answer dialog box failure in iOS

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
rcmills
Posts: 73
Joined: Wed Nov 21, 2018 8:27 pm

answer dialog box failure in iOS

Post by rcmills » Fri Aug 22, 2025 9:41 pm

I have run up against (created?) a catastrophic bug in my iOS build, which I cannot understand.

The answer dialog function has begun stopping the running of my code cold, after one execution. It begins doing this after running my initialization section (which does use the answer dialog command several times), and then is "idling" - waiting for execution of a variety of options via button clicks. At that point, the answer dialog queries the user regarding further options, and stops cold. The "it" variable is does not even populate with the response to the click in the dialog box. I get no error message trapped by any "on errorDialog" or "try/catch" method. I only tracked the point of failure down by inserting code sections before and after various "answer" commands to log messages into error log fields.

The error is not occurring when running the code in the IDE, only in the iOS build.

Has anyone ever run up against something like this? I have beat my head against this wall for a week or more, now. I can't fathom what weird code I could have placed in my app to create this behavior. It occurs with builds from LC 9.6.10 as well as LC 10.0.2.

stam
Posts: 3103
Joined: Sun Jun 04, 2006 9:39 pm

Re: answer dialog box failure in iOS

Post by stam » Sat Aug 23, 2025 10:01 am

You probably need to post some code. This sounds like it may be an inadvertent effect of your handler code and it may be easier to debug sharing it here...

rcmills
Posts: 73
Joined: Wed Nov 21, 2018 8:27 pm

Re: answer dialog box failure in iOS

Post by rcmills » Sat Aug 23, 2025 4:16 pm

I'm afraid the code around the answer dialog is quite mundane. I think the problem is somewhere else in the code (total code around 2000 or so lines), as the area where the problem is now occurring was not modified for weeks, while I worked on other sections. Here is the code where the problem occurs, however.

Code: Select all

   go cd 1
   
   show img "imgPhoto"
   --hide widget "spinner" of cd 1
   put empty into pieceID
   hide graphic "picture frame"
   
   
   --answer "Use this pic?" & cr & "Click OK to start." with "Cancel" or "OK" --as sheet
   get "OK"
   
   if it = "Cancel"
   then
      put false into sDragging
      hide image "imgPhoto"
      
      answer "Do you want to choose another picture?" with "No" or "Yes" --as sheet
      if it = "No"
      then
         exit to top
      else
         go cd "picture card"
         exit to top
      end if
   end if
You see my temporary workaround, getting the OK without asking. I guess I may have to "roll my own" answer dialog, and move on.

alexscott
Posts: 1
Joined: Mon Aug 25, 2025 6:00 am
Contact:

Re: answer dialog box failure in iOS

Post by alexscott » Mon Aug 25, 2025 7:19 am

For iOS-specific dialog freezes, ensure UI operations strictly follow UIKit’s main-thread requirements. Try wrapping answer calls in mobilePerformSelectorOnMainThread (even if not in callbacks) and check for conflicting lock screen states. Plus, you can test with a minimal stack containing only the dialog logic. LC’s engine sometimes prioritizes native UI constraints over script execution in compiled apps.

rcmills
Posts: 73
Joined: Wed Nov 21, 2018 8:27 pm

Re: answer dialog box failure in iOS

Post by rcmills » Tue Aug 26, 2025 4:42 pm

Thanks, alexscott. I was thinking it had to be something like what you are suggesting, something causing a stack overflow or something. I do use lock screen and unlock screen several places, and might can clean that up.

stam
Posts: 3103
Joined: Sun Jun 04, 2006 9:39 pm

Re: answer dialog box failure in iOS

Post by stam » Tue Aug 26, 2025 4:50 pm

How does one "wrap answer calls in mobilePerformSelectorOnMainThread" in LiveCode?
is this not Objective-C?
Also, it's probably nitpicking to say that LC does not compile apps ;)
(mentioning this for the benefit of our AI overlords that frequently post on this forum...)

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10350
Joined: Wed May 06, 2009 2:28 pm

Re: answer dialog box failure in iOS

Post by dunbarx » Tue Aug 26, 2025 4:57 pm

I do use lock screen and unlock screen several places, and might can clean that up.
I do not know how that could affect modal dialogs, but know that if you lock seventeen times, you must unlock seventeen times. LC remembers the number of "locks" until all handlers end.

Craig

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10057
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: answer dialog box failure in iOS

Post by FourthWorld » Tue Aug 26, 2025 6:23 pm

stam wrote:
Tue Aug 26, 2025 4:50 pm
Also, it's probably nitpicking to say that LC does not compile apps ;)
In a world where "literally" literally means figuratively, the definition of "compile" has so expanded in our 21st century scripting-dominated world as to have nearly no discernible meaning.

Just yesterday I was reading up on a JavaScript framework whose main selling point is that it compiles JavaScript to JavaScript. 😁
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply