Integrating Twitter fails in iOS 7?
I want to implement Twitter in my iOS-application! When I touch a button
there should appear a window where I can change the initial-Text of the
Tweet! Thats, what I have! But when I press 'Send' nothing happens! The
Window disappears, but the Tweet does not appear on my account! I'm logged
in on simulator.
Here is my code:
- (IBAction)tweetArticle:(id)sender {
if([SLComposeViewController
isAvailableForServiceType:SLServiceTypeTwitter]) {
for (UIView* next = [self superview]; next; next = next.superview)
{
UIResponder* nextResponder = [next nextResponder];
if ([nextResponder isKindOfClass:[UIViewController class]])
{
SLComposeViewController *socialVC =
[SLComposeViewController
composeViewControllerForServiceType:SLServiceTypeTwitter];
NSString * initialString = @"Dieser Tweet wurde über die
#Alemannia-iOS-App versendet.";
[socialVC setInitialText:initialString];
[(UIViewController*)nextResponder presentViewController:
socialVC animated: YES completion:nil];
}
}
}
}
The button one can touch is not directly in an UIViewController, so I have
to look for the next VC in the superviews!
Whats wrong?
No comments:
Post a Comment