我正在尝试将图像添加到我的 iOS 6 应用程序的推文表中。我有一个小问题。一旦用户从照片库中选择了图像,我想显示 TweetSheet 但我收到以下警告:
警告:在演示过程中尝试演示!
照片库的关闭动画完成后如何显示推文表?
这是我的代码:
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
image = [info objectForKey:UIImagePickerControllerOriginalImage];
[self dismissViewControllerAnimated:YES completion:nil];
[self tweet_image];
}
-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
[self dismissViewControllerAnimated:YES completion:nil];
}
-(void)tweet_image {
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) {
SLComposeViewController *tweetSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
[tweetSheet setInitialText:[NSString stringWithFormat: @"@%@ ", USERNAME]];
[tweetSheet addImage:image];
[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 in iOS settings." delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
[alertView show];
}
}
谢谢,丹。