0

In my project i am having 5 levels. In First and second level i can able to move and shoot at a time. When completing 2nd level i want to share it with Facebook. After facebook share i cant able to move and shoot at a time. Only one process is working(Either shoot or move). What i want to do for solve this problem.

My coding is here:

{
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];
}];

}
Taylan Aydinli
  • 4,333
  • 15
  • 39
  • 33

1 Answers1

0

You are presenting the ViewController mySLComposerSheet

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

but there is no dismiss... statement in your completionHandler

[self dismissViewControllerAnimated:YES completion:nil];

see the post https://stackoverflow.com/a/12651085/2787026

Community
  • 1
  • 1