iOS 6 アプリのツイート シートに画像を追加しようとしています。小さな問題が 1 つあります。ユーザーがフォト ライブラリから画像を選択したら、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];
}
}
ありがとう、ダン。