Как мне представить UIViewController из SKScene?

Я вхожу в iOS через Sprite Kit, который я считаю неразумным.

Моя цель - отобразить кнопку «Поделиться» после завершения игры. Нажатие на кнопку «Поделиться» должно отобразить SLComposeViewController (Twitter Share). Содержание сцены не должно меняться.

Логика игры, которая диктует «Game Over», живет в SpriteMyScene.m, подклассе SKScene.

Я могу отобразить кнопку «Поделиться» в Game Over следующим образом:

-(void)update:(CFTimeInterval)currentTime {

if (gameOver){
  UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
                [button addTarget:self
                           action:@selector(sendToController)
                forControlEvents:UIControlEventTouchDown];
                [button setTitle:@"Show View" forState:UIControlStateNormal];
                button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);
                [self.view addSubview:button]; 
    }
}

- (void)sendToController
{
    NSLog(@"ok");
    SpriteViewController *viewController = [SpriteViewController alloc];
    [viewController openTweetSheet];
}

Я застреваю, пытаясь заставить метод showTweetButton работать. Мой SpriteViewController.m выглядит так:

- (void)openTweetSheet
    {
     SLComposeViewController *tweetSheet = [SLComposeViewController
                                           composeViewControllerForServiceType:
                                           SLServiceTypeTwitter];

    // Sets the completion handler.  Note that we don't know which thread the
    // block will be called on, so we need to ensure that any required UI
    // updates occur on the main queue
    tweetSheet.completionHandler = ^(SLComposeViewControllerResult result) {
        switch(result) {
                //  This means the user cancelled without sending the Tweet
            case SLComposeViewControllerResultCancelled:
                break;
                //  This means the user hit 'Send'
            case SLComposeViewControllerResultDone:
                break;
        }
    };

    //  Set the initial body of the Tweet
    [tweetSheet setInitialText:@"just setting up my twttr"];

    //  Adds an image to the Tweet.  For demo purposes, assume we have an
    //  image named 'larry.png' that we wish to attach
    if (![tweetSheet addImage:[UIImage imageNamed:@"larry.png"]]) {
        NSLog(@"Unable to add the image!");
    }

    //  Add an URL to the Tweet.  You can add multiple URLs.
    if (![tweetSheet addURL:[NSURL URLWithString:@"http://twitter.com/"]]){
        NSLog(@"Unable to add the URL!");
    }

    //  Presents the Tweet Sheet to the user
    [self presentViewController:tweetSheet animated:NO completion:^{
        NSLog(@"Tweet sheet has been presented.");
    }];
}

Я всегда получаю что-то подобное в журналах:

- [UIView presentScene:]: нераспознанный селектор отправлен на экземпляр 0x13e63d00 2013-10-17 18: 40: 01.611 Исправление [33409: a0b]* Завершение работы приложения из-за необработанного исключения «NSInvalidArgumentException», причина: «- [UIView presentScene:]: нераспознанный селектор, отправленный экземпляру 0x13e63d00»

Ответы на вопрос(5)

Ваш ответ на вопрос