0

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];
}

}

ありがとう、ダン。

4

2 に答える 2

2

-tweet_image への呼び出しを -dismissViewControllerAnimated の完了ブロックに配置します。

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
    image = [info objectForKey:UIImagePickerControllerOriginalImage];
    [self dismissViewControllerAnimated:YES completion:^ {
        [self tweet_image];
    }];
}
于 2013-08-03T14:45:02.020 に答える
0

私は方法を考え出した。画像で確認画面を作り、そこからツイートシートを表示することにしました。

于 2013-08-03T14:43:29.997 に答える