Hi,
I am trying to get all uploaded photos from Facebook using IOS Swift. The code is below. The data has 0 elements, means no data. If I run the url in facebook api explorer, I get the data. I have got access token from Facebook and i get get profile picture without problem. But I cannot get uploaded photos from facebook. It always returns empty list. Any help will be appreciated.
public func getUploadedPhotos() -> Void
{
//let params = ["fields": "created_time.order(reverse_chronological),picture&limit=10&type=uploaded"]
let params = ["fields": "created_time,picture"]
let requestPhotoList = FBSDKGraphRequest(graphPath: "me/photos?fields=created_time,from,album&limit=10&type=uploaded", parameters: nil )!
requestPhotoList.start(completionHandler: { (connection: FBSDKGraphRequestConnection!, result: Any!, error: Any!) -> Void in
if ((error) != nil)
{
// Process error
print("Error: \(String(describing: error))")
}
else
{
let result = result as? NSDictionary
let data = result?["data"] as? NSArray;
let paging = result?["paging"] as? NSDictionary;
if((data) != nil)
{
for photos in data!
{
let photos = photos as! NSDictionary
let photourl = photos["picture"] as! String
let id = photos["id"] as! String
var photoDict = [String:String]()
photoDict[id] = photourl
self.photoList.append( photoDict)
}
}
}
}
)
}