我正在为iOS6和iPhone使用更改我的应用程序,似乎无法弄清楚为什么当我使用新的社交框架在Twitter上发帖时,我必须按两次“取消”才能关闭,其他人都有问题还是解决办法?这是按钮的代码。

- (IBAction)twitterPost:(id)sender
{
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
{
    mySLComposerSheet = [[SLComposeViewController alloc] init];
    mySLComposerSheet = [SLComposeViewController   composeViewControllerForServiceType:SLServiceTypeTwitter];
    [mySLComposerSheet setInitialText:[NSString stringWithFormat:@"This is my tweet, hello!",mySLComposerSheet.serviceType]];
    [self presentViewController:mySLComposerSheet animated:YES completion:nil];
}
[mySLComposerSheet setCompletionHandler:^(SLComposeViewControllerResult result) {
    NSLog(@"dfsdf");
    switch (result) {
        case SLComposeViewControllerResultCancelled:
            break;
        case SLComposeViewControllerResultDone:
            break;
        default:
            break;
    }
}];


}

最佳答案

如果您使用mySLComposerSheet,则效果很好...

[mySLComposerSheet setCompletionHandler:^(SLComposeViewControllerResult result) {
[mySLComposerSheet dismissViewControllerAnimated:YES completion:nil];

关于iphone - Twitter发布iOS6 'Cancel'按钮问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12617490/

10-13 03:48