Facebook crashing on first login
After a successful Facebook login (not using the proxy, but setting the secret), if I try to run anything requiring a session key (post status, execute), the app will crash with an error message about session key set to nil.
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: session_key)'
When I relaunch the app, the API calls work fine. This happened in 0.9.3 and still in 1.0
Any ideas what would be going on here?
Thanks!
3 Answers
-
Ok, I figured this out. If you try to call Ti.Facebook.setup(<api key>, <secret>) more than once, it will throw this error. I had two tabs that load facebook information, so had the setup call twice.
If you make sure to only initialize Facebook one time (e.g., in app.js), you should be good.
NOTE: this is only if you do not use a session proxy, and choose to put your secret code and api key inside your app.
-
Why would you want to include your api key AND your secret? This is very bad if you care about hackers manipulating your data.
http://www.performantdesign.com/2009/09/03/facebook-iphone-session-proxy-in-php-fbsession-getsessionproxy/
then just set sessionProxy to the url you set up that script at. Make sure to remove Facebook.setup so it will call the proxy instead.
-
Because I didn't have any server side hosting for the app, and didn't want to setup hosting just to have an FB proxy. Is it simple to decrypt an app and get at the source code? Or just theoretically someone could steal it?