【问题标题】:Multi touch is not working after facebook sharefacebook分享后多点触控不起作用
【发布时间】:2013-02-02 07:44:04
【问题描述】:

在我的项目中,我有 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];
}];

}

【问题讨论】:

  • 检查cocos2d视图的多点触控属性是否仍然启用,可能是FB视图重置了
  • 我还没有使用多点触控属性。但它发生在我身上
  • 如何在 Facebook 上发布到墙上后删除 View(v) 和 SLComposerView。

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


【解决方案1】:

您正在展示 ViewController mySLComposerSheet

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

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

[self dismissViewControllerAnimated:YES completion:nil];

见帖子https://stackoverflow.com/a/12651085/2787026

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-09
    • 2019-10-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多