Building an iOS app that takes pictures, first time always crashes

Geoff Canyon gcanyon at gmail.com
Wed Dec 11 01:11:57 EST 2013


On Tue, Dec 10, 2013 at 8:50 AM, Thomas McGrath III <mcgrath3 at mac.com>wrote:

> Don’t have time to check but I would look at the result. I think it
> returns “source not available” if there is a problem with the camera. See
> if the stack crashes before this answer dialog and what the result returns.
>

So now the code reads:

*on* takePhoto

   *if* the environment is "mobile" *then*

      mobilePickPhoto "camera",300,300

      *answer* the result

      *if* the result is "cancel" *then*

         *exit* takePhoto

      *end* *if*

   *else*

      *answer* file "pick an image:"

      *import* paint from file it

   *end* *if*
*...*

Install the app, go to snap a photo, and before the dialog even displays,
the app dies. Tried again, same thing. Interestingly, I had
Focus at Willplaying music at the time, and *that* died at the same
moment. Anyway, same
drill: started the app a third time, switched to the front camera, took a
selfie, and no problems. Switched back to the back camera, no problems.

I quit the app -- double-tap home button and swipe it up, then open it
again. Took a back photo, app died, and took out Focus at Will's audio again.
Opened the app again, and tried the back camera again, no front camera.
Second time it worked.

Now I can't even replicate that: I quit the app, start it again, take a
back photo, no problems.

In all cases where the app gets to the answer statement, the answer dialog
is empty.

curiouser and curiouser



More information about the Use-livecode mailing list