我試圖設置一個tweet按鈕。我所有的代碼似乎都在工作,除了它給了我一個錯誤」沒有已知的選擇器類方法canSendTweet'「任何建議錯誤「沒有已知的類選擇器方法canSendTweet'
- (IBAction)tweetTapped:(id)sender
{
//Check if the device can send tweets
if ([SLComposeViewController canSendTweet])
{
//Create tweet sheet and set initial text
SLComposeViewController *tweetSheet =
[[SLComposeViewController alloc] init];
[tweetSheet setInitialText:@"this is a tweet from my app"];
[tweetSheet addURL:[NSURL URLWithString:@"http://www.iosdeveloperguide.com"]];
//show tweet sheet
[self presentViewController:tweetSheet animated:YES completion:nil];
}
else
{
//Device can not tweet. Show error Notification.
UIAlertView *alertview = [[UIAlertView alloc]
initWithTitle:@"Unable to Tweet"
message:@"Please ensure that you have at least one Twitter account setup and have internet connectivity"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertview show];
}
}
@end