freshplanet / ANE-Facebook

Air Native Extension (iOS and Android) for the Facebook mobile SDK
Apache License 2.0
221 stars 123 forks source link

Expiration time-stamp is uint max value (4294967295) #186

Closed jonnyleeharris closed 9 years ago

jonnyleeharris commented 9 years ago

After a successful login to my app, the expiration timestamp returned from the Facebook.getInstance().expirationTimestamp function is always 4294967295.

I'm using the latest build of the native extension, running on iOS.

jonnyleeharris commented 9 years ago

After further digging, turns out the problem isn't in the AS part at all - but in the Objective C code.

In the main wrapper, a double is converted to a uint32 - and in some cases when this value is very high it clips at uint32 MAX value.

This occurs when the Facebook SDK is returning very large values, such as distant future values. For all intents and purposes this shouldn't happen, though.

The 'fix' is to put

if (FRENewObjectFromDouble(expirationTimestamp, &result) == FRE_OK)

To build a double, rather than an integer.

This introduces another change though - in that the returned numbers are of a very high precision.

It turned out all that the problems went away when I fixed the underlying cause of the distant future access token expiry.