我在我的iPhone应用程序中连接了一个推特选项(非常简单),但即使我连接了我的帐户,但是我发送了它发送的内容,但没有显示在我的推文提要中。
这是我的.h文件。
#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
这是我的.m文件
#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