2016-05-09 11 views
0

Facebookアカウントからすべての写真を取得したいと思います。しかし、私はそれをフェッチすることができません。私が要求するたびに、私は空の配列を取得します。Facebookからの写真を取得できません

@IBAction func shareFacebook(sender: FBSDKLoginButton) { 
     sender.readPermissions = ["public_profile", "email", "user_friends"] 
     sender.delegate = self 
     sender.loginBehavior = .Native 
    } 

//Delegate Method 
func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!) 
    { 
     print(result.token) 
     FBSDKGraphRequest.init(graphPath: "me/photos", parameters: ["fields":"age_range,name,first_name, last_name, picture.type(large)"], HTTPMethod: "get").startWithCompletionHandler { (con, res, err) in 
     print(res) 
     } 
} 

//Output = <FBSDKAccessToken: 0x12fea99a0> 
{ 
    data =  (
    ); 
} 

答えて

1

/me/photosは、許可user_photosが必要です。それはまだ動作し、あなたがアプリケーション管理者としてしようとしていることを確認し、ログインレビューについては読んでいない場合

sender.readPermissions = ["public_profile", "email", "user_friends", "user_photos"] 

:あなたがその権限を持つユーザーを認証することを確認してくださいhttps://developers.facebook.com/docs/facebook-login/review

また、/me/photosエンドポイントがありませんage_range,name,first_nameなどのフィールドがあります。これは/meエンドポイントのみです。

+0

私は簡単なステップでも欠けていました。ありがとうございました! – ankit

0
FBSDKGraphRequest(graphPath: "me", parameters: ["fields":"id,interested_in,gender,birthday,email,age_range,name,picture.width(480).height(480)"]).startWithCompletionHandler({ (connection, result, error) -> Void in 
         print(result) 
}) 
+0

実際は許可の問題でした。しかし、ありがとう! – ankit

関連する問題