Here's my code:
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
{
UIViewController* rootVC = [self getRootViewController];
SLComposeViewController *tweetSheet = [SLComposeViewController
composeViewControllerForServiceType:SLServiceTypeTwitter];
NSLog(@"Image: %f",image.size.height);
[tweetSheet addImage:image];
NSLog([tweetSheet addImage:image] ? @"True" : @"False");
[tweetSheet setInitialText: //text
[rootVC presentViewController:tweetSheet animated:YES completion:nil];
}else {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"No Twitter Account"
message: //message
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil];
[alertView show];
}
The first log returns my image's size, so it isn't nil. The second log returns False. On an iOS 6 device, I'm unable to tap the send button. On an iOS 9 device, not only can I send it, but the image is attached successfully to the tweet. Am I not correctly logging addImage? How could it tweet the image if it wasn't added? I'm trying to fix the disabled send button on iOS 6, but now I'm worried about its functionality on iOS 9 despite tweeting successfully.
Please help me resolve this, it's my last problem before I can ship my game.
This method returns NO if image does not fit in the currently available space or if the view controller has already been presented to the user (and therefore cannot be changed). For the accepted UIImage formats, see Figure 2. Image size limits are dependent on the target service and are documented by the service provider. For links to documentation for the supported services, see Table 1.
i remember a similar problem, the solution was to reformat the images (or change the dpi, dont remember now)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.