Question: I found a piece of code here on stack overflow which I use to find the facebook friend list of the current user in my app.

Now I want to test that code but, due to the version 2 restrictions I can't find any of my friends because my app is still in development and nobody can use my app. So I cannot find any using friends.

How can I test my friendlist functionality?

Answer: 
I was just dealing with the same problem that you have and it's as WizKid says:

1. <https://developers.facebook.com> and login to your account
2. Go into your app then click the "Roles" tab then the "Test Users" tab
3. Click "Add" and this window will come up. Authorize the user for your app and add the permissions you want them to give your app.

[![enter image description here](https://i.stack.imgur.com/CyYjR.png)](https://i.stack.imgur.com/CyYjR.png)

4. To add friends just click the "Edit" button then "Manage this test User's friends". Add the friends you want the user to have. (Convenient autocomplete is included for other test users)

[![enter image description here](https://i.stack.imgur.com/1q7Lx.png)](https://i.stack.imgur.com/1q7Lx.png)

5. After you do the former steps I suggest you also change the test user's name and make them a password. The password can be the same for all your test users. You should also login as the test user ("Edit" again) and change their profile picture to differentiate between them especially if you're using profile pictures.
6. Here is the annoying part; to be able to see (in your app) the test user's friends that you just set, you have to repeat the following for each of the friends you want to see in your list of facebook friends. (This is assuming that you're not getting "invitable friends")
7. Reset your simulator
8. Login using the test user's email and password in the safari popup
9. Repeat No 7, 8 for every test user (This is to make the friends "facebook friends that have used the app")
10. Good luck and don't drive yourself crazy :) Hope this helps
Another fix is that the problem may be the login function. Because after I've added the right permissions to my test friend it still failed.

I got it working but the main problem seemed to be my login functions. I wasn't using the FBSDKLoginManager. This was easily implemented by: 

```
func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!) {
    println("User Logged In")

    if ((error) != nil)
    {
        // Process error
    }
    else if result.isCancelled {
        // Handle cancellations
    }
    else {
        // If you ask for multiple permissions at once, you
        // should check if specific permissions missing
        if result.grantedPermissions.contains("email")
        {
            self.performSegueWithIdentifier("loggedIn", sender: self)
            //self.returnUserData() 

            // Do work
        }
    }
}

func loginButtonDidLogOut(loginButton: FBSDKLoginButton!) {
    println("User Logged Out")
}

```

And then 

```
override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.

    //if (FBSDKAccessToken.currentAccessToken() == nil)
    //{
        // User is already logged in, do work such as go to next view controller.
    //  self.performSegueWithIdentifier("loggedIn", sender: self)
    //    self.returnUserData()

    //}
    //else
    //{
        let loginView : FBSDKLoginButton = FBSDKLoginButton()
        self.view.addSubview(loginView)
        loginView.center = self.view.center
        loginView.readPermissions = ["public_profile", "email", "user_friends"]
        loginView.delegate = self
    //}

    // Do any additional setup after loading the view.
}

```

This fixed my problem completely after giving the test friend permission.