Objective c SLComposeViewController取消不';不要一次点击就关闭VC

Objective c SLComposeViewController取消不';不要一次点击就关闭VC,objective-c,social-framework,Objective C,Social Framework,我对附件有问题。当用户点击取消按钮上的一次时,它必须关闭当前显示的modalViewController,而不是像现在这样点击两次 代码 -(BOOL)isIOS6{ BOOL native=是; 如果([[[UIDevice currentDevice]系统版本]浮点值]

我对附件有问题。当用户点击取消按钮上的一次时,它必须关闭当前显示的modalViewController,而不是像现在这样点击两次

代码

-(BOOL)isIOS6{
BOOL native=是;
如果([[[UIDevice currentDevice]系统版本]浮点值]<6.0f){
本地=否;
}
归国;
}
-(作废)推特共享{
DLog(@“is ios6:%d”,[self isIOS6]);
如果([self isIOS6]){
如果([SLComposeViewController可用于服务类型:SLServiceTypeTwitter])
{
NSString*textToShare=@“测试”;
SLComposeViewController*twitterComposeViewController=[SLComposeViewController ComposeViewController服务类型:SLServiceTypeTwitter];
twitterComposeViewController.completionHandler=^(SLComposeViewController结果){
DLog(@“结果:%d”,结果);
如果(结果==1){
Dlog(@“共享”);
[[NSNotificationCenter defaultCenter]postNotificationName:@“NotificationName”对象:nil];
DLog(@“发送奖金通知”);
[带标签的自禁用按钮:成长按钮WitterConnectionTag];
DLog(@“禁用该按钮”);
}否则{
Dlog(@“已取消…”);
}
};
[twitterComposeViewController设置初始文本:textToShare];
[自我呈现视图控制器:twitterComposeViewController动画:是完成:无];
}否则{
DLog(@“推特不可用”);
}
}否则{
//不支持iOS 5消息
[[[UIAlertView alloc]initWithTitle:NSLocalizedString(@“注意”,无)
消息:NSLocalizedString(@“IOS6”或“IOS6”以上的功能”,无)
代表:无
取消按钮提示:NSLocalizedString(@“OK”,无)
其他按钮类型:无,无]自动释放]显示];
}
}

我已通过以下代码解决了该问题:

tweetSheet.completionHandler = ^(SLComposeViewControllerResult result) {
    switch(result) {
            //  This means the user cancelled without sending the Tweet
        case SLComposeViewControllerResultCancelled:
            break;
            //  This means the user hit 'Send'
        case SLComposeViewControllerResultDone:
            [[NSNotificationCenter defaultCenter] postNotificationName:@"kGrowthProvideTwitterBonus" object:nil];
            DLog(@"Sended provide bonus notification");
            [self disableButtonWithTag:TTGrowthButtonTwitterConnectTag];
        break;
    }

    //  dismiss the Tweet Sheet
    dispatch_async(dispatch_get_main_queue(), ^{
        [self dismissViewControllerAnimated:NO completion:^{
            NSLog(@"Tweet Sheet has been dismissed.");
        }]; 
    });
};

我已通过以下代码解决了该问题:

tweetSheet.completionHandler = ^(SLComposeViewControllerResult result) {
    switch(result) {
            //  This means the user cancelled without sending the Tweet
        case SLComposeViewControllerResultCancelled:
            break;
            //  This means the user hit 'Send'
        case SLComposeViewControllerResultDone:
            [[NSNotificationCenter defaultCenter] postNotificationName:@"kGrowthProvideTwitterBonus" object:nil];
            DLog(@"Sended provide bonus notification");
            [self disableButtonWithTag:TTGrowthButtonTwitterConnectTag];
        break;
    }

    //  dismiss the Tweet Sheet
    dispatch_async(dispatch_get_main_queue(), ^{
        [self dismissViewControllerAnimated:NO completion:^{
            NSLog(@"Tweet Sheet has been dismissed.");
        }]; 
    });
};