- (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并保存到设备工作。推特没有。为什么不呢?
答案 0 :(得分: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];