I'm having problems getting my application to post to Facebook...
I have twitter posting fine. But when I try posting to Facebook it freezes/is unresponsive...
Originally I followed AppCoda's tutorial. Twitter works, but Facebook's implementation doesn't...
Then I changed to code to GeekyLemons tutorial:
//mySLComposerSheet = [[SLComposeServiceViewController alloc] init];
mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[mySLComposerSheet setInitialText:@"Place Text Here"];
[self presentViewController:mySLComposerSheet animated:YES completion:nil];
But that doesn't work...
Then I tried all the example answers give on THIS ANSWER here on the exchange, still nothing.
Then I tried using the Twitter code and changing it to Facebook to keep it basic:
SLComposeViewController *fbSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[fbSheet setInitialText:@"So... I just posted from my App :)"];
[self presentViewController:fbSheet animated: YES completion: nil];
Same thing...
When the IBAction
is called/the PostToFacebook
button in pressed, it brings up the little text window, but DOESN'T have the text inside of it thats pre written in the code above. Then when I type something (because the text that should appear, doesn't) and press post, the window closes and the app freezes... :(
I don't know what else to try... I'm completely stumped. I don't see why all of the tutorials/examples have the same issue... None place the text in the window, and after pressing post, it freezes.
It's worth mentioning that I have Facebook set up on my device, just like twitter... Twitter works, but Facebook doesn't.
Is there anything else I can try? Or am I being really stupid and missing something.? Thank you.
Update
I started a brand new project incase my application was doing something strange, but unfortunately when I run it, it still isn't working :(
ViewController.h:
#import <UIKit/UIKit.h>
#import <Social/Social.h>
#import <Accounts/Accounts.h>
@interface ViewController : UIViewController{
SLComposeViewController *mySLComposerSheet;
}
-(IBAction)PostToFacebook:(id)sender;
@end
ViewController.m
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
-(IBAction)PostToFacebook:(id)sender{
NSLog(@"PostToFacebook Button Pressed...");
mySLComposerSheet = [[SLComposeViewController alloc] init];
NSLog(@"Allocated Memory......");
mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
NSLog(@"Composed Service...");
[mySLComposerSheet setInitialText:@"Hello World"];
NSLog(@"Set Text...%@", mySLComposerSheet);
[self presentViewController:mySLComposerSheet animated:YES completion:nil];
NSLog(@"Presenting ViewController...");
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSLog(@"ViewDidLoad...");
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
And I've linked up the "PostToFacebook" button in the Storyboard... using Touch Up Inside
... Still nothing :(
Another Update
So I've just tested it on the iOS Simulator
and it works after signing into Facebook in the simulators settings... But it's still not working on my iPhone 6+ device... even though Twitter does...?!?!