0
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex
{
    forTweet = TRUE;
    switch(buttonIndex)
    {
            case 0:
            {
                TWTweetComposeViewController *tweetViewController = [[TWTweetComposeViewController alloc] init];

                // Set the initial tweet text. See the framework for additional properties that can be set.
                NSMutableString * twitterString = [displayString mutableCopy];
                [twitterString appendString: @" #LoviOtvet"];

                [tweetViewController setInitialText: twitterString];

                UIImage * imageAnswer = [self getImageFromURL: [self strToUrlConverter]];
                UIImage * imageLogo = [[UIImage alloc] initWithContentsOfFile: @"image.png"];

                [tweetViewController addImage: [self mergeImage:imageAnswer withImage:imageLogo strength:1]];


                break;
            }

我补充说。没有错误,但不工作。Facebook 和保存到设备工作。发推文不行。为什么不?

4

1 回答 1

2

你的问题是这一行:

UIImage * imageLogo = [[UIImage alloc] initWithContentsOfFile: @"image.png"];

对于此方法,您需要提供文件路径,而不是名称。你有两个选择:

UIImage * imageLogo = [UIImage imageNamed:]

或(对于包中的文件):

NSString *path = [[NSBundle mainBundle] pathForResource:@"image" ofType:@"png"];
UIImage * imageLogo = [[UIImage alloc] initWithContentsOfFile:path];
于 2012-08-10T12:28:35.450 回答