[gambit-list] iOS Embedding -- Don't see errors / exceptions

Axis Sivitz aosivitz at gmail.com
Wed Apr 24 13:14:09 EDT 2013


For some reason if I setup the exception-handler manually it works, even if I don't use NSLog. (And functions like println work also).
So, I'm putting this code at the very top of the first .scm file that I link in.

(current-exception-handler (lambda (exc) 
                             (continuation-capture (lambda (cont) 
                                                     (display-exception-in-context exc cont)
                                                     (display-continuation-backtrace cont)))))

This way I get an error message and backtrace. It would be nicer if I could get an interactive debugging repl, but I'm not sure how to do that. So this is sufficient for now.

On Apr 24, 2013, at 11:52 AM, Zhen Shen wrote:

> You have to use NSLog on iOS.
> 
> I think recent versions of iOS disable stdout altogether.
> 
> From: aosivitz at gmail.com
> Date: Tue, 23 Apr 2013 17:25:33 -0400
> To: gambit-list at iro.umontreal.ca
> Subject: [gambit-list] iOS Embedding -- Don't see errors / exceptions
> 
> Errors thrown from scheme code embedded in an iOS app don't get displayed anywhere. Instead, the the program just hangs.
> 
> I see the same behavior in the example GambitREPL app. If I add in an error (for example, calling (cons 1), wrong is the number of arguments) to the program.scm file, it will hang on launch, and the error message won't be displayed in stdout (which is ideally where I'd like it to go).
> 
> I'm using the following debug_settings:
> 
>    debug_settings =
>    (debug_settings
>     & ~___DEBUG_SETTINGS_UNCAUGHT_MASK)
>    | (___DEBUG_SETTINGS_UNCAUGHT_ALL
>       << ___DEBUG_SETTINGS_UNCAUGHT_SHIFT);
>    
>    debug_settings =
>    (debug_settings
>     & ~___DEBUG_SETTINGS_ERROR_MASK)
>    | (___DEBUG_SETTINGS_ERROR_REPL
>       << ___DEBUG_SETTINGS_ERROR_SHIFT);
> 
> but I've also tried 
> 
>    debug_settings =
>    (debug_settings
>     & ~___DEBUG_SETTINGS_REPL_MASK)
>    | (___DEBUG_SETTINGS_REPL_STDIO
>       << ___DEBUG_SETTINGS_REPL_SHIFT);
> 
> and I've also tried wrapping my scheme calls in
> 
> ___BEGIN_TRY
> ___END_TRY
> 
> I apologize for all the questions regarding setting up an iOS/Scheme development environment, but I'll be sure to document everything once I get it all working to help other folks in the future.
> 
> Thanks,
> Axis
> 
> _______________________________________________ Gambit-list mailing list Gambit-list at iro.umontreal.cahttps://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20130424/ebf69d50/attachment.htm>


More information about the Gambit-list mailing list