Facebook分享后多点触控不起作用

时间:2013-02-02 07:44:05

标签: ios xcode facebook cocoa-touch cocos2d-iphone

在我的项目中,我有5个级别。在第一和第二级,我可以一次移动和拍摄。完成第二级时,我想与Facebook分享。在facebook分享之后,我无法一次移动和拍摄。只有一个过程正常工作(拍摄或移动)。 我想做什么来解决这个问题。

我的编码在这里:

{
UIViewController*v=[[UIViewController alloc]init];
[[[CCDirector sharedDirector]openGLView]addSubview:v.view];
SLComposeViewController*mySLComposerSheet;
if([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) 
{

    NSString *strg=[NSString stringWithFormat:@" "];

    NSString *bodyStr=[NSString stringWithFormat:@"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"!\n;


    mySLComposerSheet = [[SLComposeViewController alloc] init]; 
    mySLComposerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook]; //Tell him with what social plattform to use it, e.g. facebook or twitter
    [mySLComposerSheet setInitialText:bodyStr]; //the message you want to post
    [mySLComposerSheet addImage:[UIImage imageNamed:@"my.jpg"]]; //an image you could post

    NSURL *url = [NSURL URLWithString:@"https:example.com"];
    [mySLComposerSheet addURL:url];


    [v presentViewController:mySLComposerSheet animated:YES completion:nil];
}
[mySLComposerSheet setCompletionHandler:^(SLComposeViewControllerResult result) {
    NSString *output,*head;
    switch (result) {
        case SLComposeViewControllerResultCancelled:
            output = @"FREE levels NOT unlocked";
            head=@"Facebook Share Unsuccessfull";
            UIAlertView *alert1 = [[UIAlertView alloc] initWithTitle:head message:output delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
            [alert1 show];
            [self reload];
            break;
        case SLComposeViewControllerResultDone:
            output = @"Extra FREE levels successfully unlocked";
            head=@"Successfull";
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:head message:output delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
            [alert show];
            alert.tag=22;
                  break;
        default:
            break;
    } 
     UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Facebook" message:output delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
    [alert show];
}];

}

1 个答案:

答案 0 :(得分:0)

您正在展示ViewController mySLComposerSheet

[v presentViewController:mySLComposerSheet animated:YES completion:nil];

但是你的completionHandler中没有dismiss ...语句

[self dismissViewControllerAnimated:YES completion:nil];

查看帖子https://stackoverflow.com/a/12651085/2787026