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

Я захожу в iOS через Sprite Kit, что, по моему мнению, неразумно.

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

Логика игры, которая диктуетИгра окончена" живет в SpriteMyScene.m, подклассе SKScene.I '

Я могу отображать кнопку «Поделиться» в игре «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)

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