Facebook sharing doesn't work
I ran into one problem: on a 64-bit architecture of an iOS device, the sharing function (Twitter and Facebook) does not work. When I run the same code on an iOS device with a 32-bit architecture, it works fine. I also changed architecture like armv7 armv7s arm64 . But still I faced the same problem.
Here is my code:
/* Facebook sharing */
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[controller setInitialText:ARTICLE_GLOBAL_Title];
[controller addImage:[UIImage imageNamed:@"144X144.png"]];
[controller addURL:[NSURL URLWithString:ARTICLE_GLOBAL_Link]];
[self presentViewController:controller animated:YES completion:nil];
Here's the result:
plugin com.apple.share.Facebook.post aborted hub connection error Domain error = NSCocoaErrorDomain Code = 4097 "Operation could not be completed. (Cocoa error 4097.)" (connecting to service named com.apple.share.Facebook.post ) UserInfo = 0x7f839249d090 {NSDebugDescription = connecting to a service named com.apple.share.Facebook.post}
+3
source to share
1 answer
See how it helps.
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
SLComposeViewControllerCompletionHandler myBlock = ^(SLComposeViewControllerResult result)
{
if (result == SLComposeViewControllerResultCancelled)
{
NSLog(@"User Cancelled");
[callout dismiss];
}
else
{
NSLog(@"Item successfully posted on your wall.");
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:nil message:@"Hello world." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
[callout dismiss];
}
[controller dismissViewControllerAnimated:YES completion:nil];
};
controller.completionHandler = myBlock;
//Adding the Text to the facebook post value from iOS
controller.title = lblTitle.text;
[controller addImage:imagenews.image];
0
source to share