0

I connected a tweeting option in my iPhone app (really simple one) but even though I connected my account when ever i tweet something it sends but doesn't show up in my twitter feed.

This is my .h file.

#import <UIKit/UIKit.h>

@interface XYZViewController : UIViewController

@property (weak, nonatomic) IBOutlet UITextField *maintitle;

@property (weak, nonatomic) IBOutlet UITextField *numberone;

@property (weak, nonatomic) IBOutlet UITextField *dos;

@property (weak, nonatomic) IBOutlet UITextField *tres;

- (IBAction)tweetTapped:(id)sender;

@property (weak, nonatomic) IBOutlet UITextField *cutro;

@property (weak, nonatomic) IBOutlet UITextField *cindo;

@property (weak, nonatomic) IBOutlet UITextField *seis;

@property (weak, nonatomic) IBOutlet UITextField *seba;

@end

This is my .m file

#import "XYZViewController.h"
#import <Social/Social.h>

@interface XYZViewController ()
@end

@implementation XYZViewController

@synthesize numberone, dos, tres, cutro, cindo, seis, seba, maintitle;

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

- (IBAction)tweetTapped:(id)sender {
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
{
    SLComposeViewController *tweetSheet = [SLComposeViewController   
   composeViewControllerForServiceType:SLServiceTypeTwitter];
    [tweetSheet setInitialText:@"Tweeting from my own app! :)"];
    [self presentViewController:tweetSheet animated:YES completion:nil];
}
else
{
    UIAlertView *alertView = [[UIAlertView alloc]
                              initWithTitle:@"Sorry"
                              message:@"You can't send a tweet right now, make
  sure your device has an internet connection and you have at least one
  Twitter account setup"
                              delegate:self
                              cancelButtonTitle:@"OK"
                              otherButtonTitles:nil];
    [alertView show];
}
}



@end
Joe salad
  • 55
  • 6
  • Just tested this code and it works fine. :) https://twitter.com/alistair1975/status/580882149194219520 Try logging out of the Twitter account and back in again. – Alistair McMillan Mar 26 '15 at 00:03
  • i tried that but it still wouldnt work its so frustrating, i also linked the framework and double checked that the button was connected – Joe salad Mar 27 '15 at 00:29
  • i also keep getting the error Failed to inherit CoreMedia permissions from 1712: (n – Joe salad Mar 27 '15 at 00:35
  • I think the problem must be somewhere else in your code. Cause the code you pasted here works fine. I literally started a new project in Xcode, copied your code in, dragged a button into the window, connected it to the tweetTapped IBAction and hit run. And it worked right away. – Alistair McMillan Mar 27 '15 at 00:38
  • sorry i gave you the wrong error it actually said The connection to com.apple.twitter.xpc was invalidated. and i used the same code – Joe salad Mar 27 '15 at 00:40
  • This might sound silly but are you definitely using the right password? Cause that seems like the error you get if you have the wrong password. http://stackoverflow.com/a/19988462/35794 – Alistair McMillan Mar 27 '15 at 00:45
  • twitter says unavailable in iphone simulator twitter settings. – Joe salad Mar 28 '15 at 13:45

0 Answers0