Presenting a viewController on SKScene

I am trying to present UIActivityViewController on an SkView but xcode gives me this error :

No visible @interface for ‘GameOver’ declares the selector

  • CUICatalog: Invalid Request: requesting subtype without specifying idiom
  • Undefined symbols for architecture armv7?
  • OTHER_CODE_SIGN_FLAGS keychain flag ignored?
  • How to show remote push notification as a banner style in active state of app?
  • Adding large Power values in Xcode
  • Is it possible to run iOS simulator on a Mac without Xcode installed?
  • - (void)shareScore {
        //add view
        UIView *Sview  = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 512, 512)];
        UIImageView *image = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"shareScoreImg.png"]];
        image.frame = Sview.frame;
        [Sview addSubview:image];
        //add label
        CGRect fframe = self.view.frame;
        UILabel *score = [[UILabel alloc] initWithFrame:fframe];
        score.text = @"9999";
        score.textAlignment = NSTextAlignmentCenter;
        score.textColor = [UIColor darkGrayColor]; = CGPointMake(250, 440);
        score.font = [UIFont fontWithName:@"Pixel LCD7" size:50];
        [Sview addSubview:score];
        //capture view
        UIGraphicsBeginImageContextWithOptions(Sview.bounds.size, Sview.opaque, 0.0);
        [Sview.layer renderInContext:UIGraphicsGetCurrentContext()];
        UIImage * screenshot = UIGraphicsGetImageFromCurrentImageContext();
        UIActivityViewController* activityViewController =
        [[UIActivityViewController alloc] initWithActivityItems:@[screenshot]
        [self presentViewController:activityViewController animated:YES completion:nil];

    How can I present preset a viewController on SKScene ?
    thanks .

    2 Solutions Collect From Internet About “Presenting a viewController on SKScene”

    We can use “presentModalViewController” by using this code to access the root view controller

     UIViewController *vc = self.view.window.rootViewController;
        [vc presentViewController: activityViewController animated: YES completion:nil];

    now it works fine !

    IIRC the first SKScene that you create is inside an SKView.

    This SKView is inside a UIViewController.

    You can use properties or delegation or whatever you like to access methods on the UIViewController through the SKView from the SKScene. Or even use a notification.

    Then on the UIViewController you can present the new view controller with no problems.