ios - Post multiple images using SLComposeViewController on Facebook/ Twitter? -


I am using SLComposeViewController to share'm an iOS developer and I am currently a post on Facebook / Twitter. My problem is that I have to post multiple images in a post.

I thus have:

  SLComposeViewController * mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType: SLServiceTypeTwitter]; [MySLComposerSheet Set InitialText: textTobeShared]; MySLComposer Sheet addURL: [NSURL URLWithString: @ "http://click-labs.com/"]; (; Count of & lt; imageArray.count; int count = 0 count ++) if ([mySLComposerSheet addImage: [UIImage imageWithData: [imageArray objectAtIndex: count]]])  

In the above code, ImageArray is the array of images that I want to post.

When I am doing this on Facebook, all the images are posted as a separate post.

In the case of Twitter, the addimage method gives the actual returns only for the first images, while in the case of other images, it incorrectly only because only one image has been posted.

So I want to know how to achieve my goal and whether it is possible to post many images in the same tweet.

I think you must first create an album.

Here is a documentation

  - (zero) shareToFacebook {(FBSession.activeSession.isOpen) {NSLog (@ "session is open") [Self-Made Facebook Album]; } And {nslog (@ "session is not open"); NSArray * Permissions = [NSArray arrayWithObject: @ "email"]; [FBSession openActiveSessionWithReadPermissions: permissions allowLoginUI: Yes completionHandler: ^ (FBSession * session, FBSessionState state, NSError * error) {[self sessionStateChanged: Session State: State error: error]; If (error) {/ * handle failure * / NSLog (@ "error:% @,% @", error, [error localization]]; UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @ "Error" Message: @ "There was a problem with your Facebook permissions." Representative: cancel zerotutite: @ "OK" other button titles: zero]; [Alerts show]; } And if (state == FBSessionStateClosed || state == FBSessionStateClosedLoginFailed) {[FBSession.active session closed and clearToken notice]; } Else if (state == FBSessionStateOpenTokenExtended || state == FBSessionStateOpen) {if (self.presentedFacebookSheet!) {[Self performSelector: @selector (reauthorizeAndContinuePostToFacebook) withObject: afterDelay zero: 0.5]; Self.presentedFacebookSheet = Yes; }}}]; }} - (Zero) Re-authorization and Continuity Tufusbook {NSArray * Permissions = [NSArray arrayWithObjects: @ "publish_actions", zero]; [[FBSession activeSession] requestNewPublishPermissions: permissions defaultAudience: FBSessionDefaultAudienceFriends completionHandler: ^ (FBSession * session, NSError * error) {[self shareToFacebook]; }]; } - (zero) createFacebook album {NSMutableDictionary * parameters = [NSMutableDictionary dictionary]; [Parameter set object: @ "test name": @ "name"]; [Parameter set object: "test message" for "message": @ "message"]; FBSEEEE * Request = [FBSECC Request With-Graph: @ "Me / Albums" Parameter: Parameter HTTPMethod: @ "POST"]; NSLog (@ "Creating Facebook Album"); FBSEX Connection * Connection = [[FBCACC Connection Allocation] IIT]; [Connection addRequest: Request complete handler: ^ (FBCACC connection * connection, ID result, NSERR * error) {if (error!) {NSString * albumId = [result objectForKey: @ "id"]; NSLog (@ "OK% @", album ed); } And {NSLog (@ "error:% @", error.userInfo); }}]; [Connection start]; } (Zero) sessionStateChanged: (FBSession *) Session State: (FBSessionState) State Error: (NSError *) Error {Switch (State) {Case FBSessionStateOpen: {{FBC Request Request} Initial Termination: ^ (FBCAC Connection Connection, NSDictionary & Lt; FBGraphUser & gt; * User, NSError * error) {if (error) {// error} other {NSLog (@ "user session found"); }}]; }             break; Case FBSessionStateClosed: Case FBSessionStateClosedLoginFailed: [FBSession.active session closure and ClearToken Notice]; break; Default: Break; }}  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -