Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use FBTestSession
    text
    copied!<p>I am building a native iOS app that will allow the user to sign into Facebook and 'like' Open Graph objects. I'm trying to write unit tests for my code that does the built-in likes. I created test users in the admin web page of the Facebook app, and what I would like to do in a unit test is sign in as a test user, 'like' an open graph object, check to make sure the number of 'likes' changed, then 'unlike' it.</p> <p>I'm using the Facebook iOS SDK, and it comes with FBTestSession which I thought would be perfect for my needs. My understanding is that it will randomly grab a test user to sign in as (or create a temporary one if you desire). However, there have been a couple of issues and I don't see any documentation explaining it.</p> <p>The first issue: it tries to load FacebookSDK-UnitTestConfig.plist from the Documents directory to read the AppID and AppSecret. To fix this issue, I made such a file and I copy it over to the Documents directory at the start of the test. Is this the correct thing to do?</p> <p>The second issue is that it throws an error when I try to open the test session, with a 400 response code and no helpful message. Looking at the request it tries to make, it seems it is using fql to query for all the test accounts. When I enter the appropriate URL in a web browser </p> <p><code>https://graph.facebook.com/fql?access_token=ACCESS_TOKEN&amp;q=SELECT id,access_token FROM test_account WHERE app_id = APP_ID)</code></p> <p>I get the error message "(#15) This method is not supported for native apps". But clearly FBTestSession is meant for native apps, so what is going on?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload