2013-02-02 42 views
0

在我的項目中,我有5個關卡。在第一和第二級,我可以一次移動和射擊。當完成第二級時,我想與Facebook分享。在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"; 
      [email protected]"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"; 
      [email protected]"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]; 
}]; 

} 
+0

檢查cocos2d視圖的多點觸控屬性是否仍然啓用,也許它是由FB視圖重置 – LearnCocos2D

+0

我還沒有使用多點觸摸屬性。但它發生在我 – iphoneguyzzz

+0

如何刪除視圖(v)和SLComposerView後發佈到牆上的Facebook。 – iphoneguyzzz

回答

0

您呈現的ViewController mySLComposerSheet

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

但沒有解僱...語句在completionHandler

[self dismissViewControllerAnimated:YES completion:nil]; 

看post https://stackoverflow.com/a/12651085/2787026