Note that there are some explanatory texts on larger screens.

plurals
  1. POFacebook iOS SDK: Cannot specify an album using FBRequest's requestForUploadPhoto:
    text
    copied!<p>I have a local photo in my iPhone app, and I want to upload it to a specific album on Facebook dedicated to my app.</p> <p><strong>Problem:</strong> My app name ends with the word 'Photos', so the default Facebook album is <code>APP_NAME Photos Photos</code> - obviously a problem.</p> <p><strong>Goal:</strong> I want to create a new album, store its ID in <code>NSUserDefaults</code>, and (after some validation at runtime) use it for all future photos being uploaded from the app.</p> <p><strong>Where I'm at:</strong> I can make the new album via Open Graph, using my desired name and description, and I can retrieve its ID. I can also upload photos easily enough. However, what I CANNOT figure out is how to specify where that uploaded photo ends up!</p> <p><strong>Code:</strong> Here's my photo upload code with some results commented in. I'm assuming this is where my problem is, since album creation, etc, is working perfectly.</p> <pre><code>- (void)postPhotosToFacebook:(NSArray *)photos withAlbumID:(NSString *)albumID { // Just testing with one image for now; I'll get in to multiple later.. UIImage *image = [photos lastObject]; FBRequest *imageUploadRequest = [FBRequest requestForUploadPhoto:image]; // CALL OUT: I'm guessing my problem is here - but I just don't know! [[imageUploadRequest parameters] setValue:albumID forKey:@"album"]; DebugLog(@"imageUploadRequest parameters: %@",[imageUploadRequest parameters]); // Results of DebugLog: // imageUploadRequest parameters: { // album = 10151057144449632; // picture = "&lt;UIImage: 0xc6b6920&gt;"; // } // The album data returns correctly using FB's Graph API explorer tool, // so I know it's a legit album. // https://developers.facebook.com/tools/explorer FBRequestConnection *connection = [[FBRequestConnection alloc] init]; [connection addRequest:imageUploadRequest completionHandler:^(FBRequestConnection *connection, id result, NSError *error) { if (!error) { DebugLog(@"Photo uploaded successfuly! %@",result); // Results of DebugLog: // // Photo uploaded successfuly! { // id = 10151057147399632; // "post_id" = "511304631_10151057094374632"; // } // Again, the photo at that ID shows up correctly, etc - // BUT it's in the wrong album! It shows up in the default app album. } else { DebugLog(@"Photo uploaded failed :( %@",error.userInfo); } }]; [connection start]; } </code></pre> <p><strong>Guesses:</strong> I'm guessing my problem is somewhere in how I'm assigning my album ID parameter to the image request.. but I have no clue.</p> <p>You can see at <a href="https://developers.facebook.com/docs/sdk-reference/iossdk/3.0/class/FBRequest/#//api/name/requestForUploadPhoto%3a" rel="nofollow">this URL</a> that this should be possible..</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