On Sun, Jan 8, 2012 at 1:12 PM, dermotos <[email protected]> wrote:

> Im implementing the facebook sdk in my app. Nearly there, however I cannot
> test it on the simulator.
>
> Similar to the examples, I create the Facebook object in my AppDelegate.
> When i attempt an Authorise() call on the simulator, it redirect to the
> Safari app, as expected. I authorise the permissions requested, and Safari
> redirects back to my app. However, I receive an error when I attempt to
> call
> the HandleOpenUrl() method of the Facebook object, stating that it has been
> garbage collected.
>
> This only happens on the simulator, not the device. Id much prefer to be
> using the simulator, as debugging on the device is buggy (that's another
> story!).
>
> Is there some reason why the GC is more agressive on the simulator? How can
> I force the object, which remains in scope to not be GC'd when the app
> enters the background state for a few seconds? (during facebook's
> authorisation procedure).
>

If it remains in scope it won't be GC'ed, so something unexpected is
probably happening that makes you think it's in scope. The 100% certain way
of making sure an object is not collected by the GC, is to store it in a
static variable (but ensure you clear out the variable once you're done
with it, since otherwise the GC will never free the object).

Rolf


>
> --
> View this message in context:
> http://monotouch.2284126.n4.nabble.com/Garbage-collection-on-simulator-tp4275544p4275544.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch
>
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to