Я пытаюсь добавить изображение на лист твитов в своем приложении для 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];
}
}
Спасибо, Дэн.