Facebook function integration iOS6

I am trying to export a screenshot from my application to Facebook using the iOS6 function of Facebook. How can I reveal the parameters inside the application when I click the button?

Below is my current code. I want to take a screenshot and at the same time export to Facebook using the iOS6 function of Facebook.

- (IBAction)export1:(id)sender{ NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; [self.tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES]; exporting.hidden=YES; CGSize imageSize = [[UIScreen mainScreen] bounds].size; if (NULL != UIGraphicsBeginImageContextWithOptions) UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0); else UIGraphicsBeginImageContext(imageSize); CGContextRef context = UIGraphicsGetCurrentContext(); // Iterate over every window from back to front for (UIWindow *window in [[UIApplication sharedApplication] windows]) { if (![window respondsToSelector:@selector(screen)] || [window screen] == [UIScreen mainScreen]) { // -renderInContext: renders in the coordinate space of the layer, // so we must first apply the layer geometry to the graphics context CGContextSaveGState(context); // Center the context around the window anchor point CGContextTranslateCTM(context, [window center].x, [window center].y); // Apply the window transform about the anchor point CGContextConcatCTM(context, [window transform]); // Offset by the portion of the bounds left of and above the anchor point CGContextTranslateCTM(context, -[window bounds].size.width * [[window layer] anchorPoint].x, -[window bounds].size.height * [[window layer] anchorPoint].y); // Render the layer hierarchy to the current context [[window layer] renderInContext:context]; // Restore the context CGContextRestoreGState(context); } } // Retrieve the screenshot image CGRect contentRectToCrop = CGRectMake(0, 70, 740, 740); UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); CGImageRef imageRef = CGImageCreateWithImageInRect([image CGImage], contentRectToCrop); UIImage *croppedImage = [UIImage imageWithCGImage:imageRef]; UIGraphicsEndImageContext(); UIImageWriteToSavedPhotosAlbum(croppedImage, nil, nil, nil); 
+4
source share
3 answers

Here you can easily post images to Facebook using the built-in Facebook SDK in iOS6. Happy if that helps you anyway. Happy coding :)

+2
source

Apple's developer site offers new social help to integrate social experiences like Twitter and Facebook.

Contact here .

+2
source

@Clarence, I think you should check out the latest Facebook SDK for iOS

It also has some tutorials on how to post images to facebook in iOS 6.

Just download the SDK and you will find sample code in the Documents folder, which includes a HelloFacebookSample sample that shows how to post an image on facebook in iOS 6.

you just need to pass your image object to this method -

 [FBNativeDialogs presentShareDialogModallyFrom:self initialText:nil image:croppedImage url:nil handler:nil]; 

Before using the above method, you need to correctly follow the installation instructions v 3.1 here

+1
source

All Articles