Wie präsentiere ich UIViewController von SKscene mit sozialem Framework?

Ich mache ein Spiel wie Flappy Bird. Wie präsentiere ich einen UIViewController von SKScene? Zunächst erzähle ich meine Umgebungen

Mac OS X 10.9Xcode 5.0.2
Sprite Kit (Framework), social.framework (Framework) sind in meinem Projekt hinzugefügt

Mein Ziel ist es, beim Spielende einen "Teilen" -Button anzuzeigen. Wenn Sie auf die Schaltfläche "Teilen" tippen, sollte ein SLComposeViewController (Twitter Share) angezeigt werden. Der Inhalt der Szene sollte sich nicht ändern.
Ich möchte das folgende Problem lösen und die Anzeige von GameOverScene in tweetSheet (Anzeige) ändern, das mit social.framework erstellt wurde.

Die Angelegenheit

[self presentViewController:tweetSheet animated:YES completion:nil];
//Error:No visible @interface for 'GameOverScene' declares the selector "presentViewController":animated:completion:


Meine Codierungsdateien sind unten (ich habe Teile wichtiger Codes extrahiert).

ViewController.h

import <UIKit/UIKit.h>
import <SpriteKit/SpriteKit.h>
import <iAd/iAd.h>

@interface ViewController : UIViewController<ADBannerViewDelegate><br>

@end

GameOverScene.h

#import <SpriteKit/SpriteKit.h> 

@class SpriteViewController;

@interface GameOverScene : SKScene {
}
@end

GameOverScene.m

#import "GameOverScene.h"
#import "NewGameScene.h"
#import "MainScene.h"
#import <Social/Social.h>
@implementation GameOverScene {
   //The twitter button 
    SKSpriteNode *_twitterbutton;
}
- (id)initWithSize:(CGSize)size
{
    if (self = [super initWithSize:size]) {
        //Creating the twitterbutton with the twitterbutton image from Images.xcassets
        _twitterbutton = [SKSpriteNode spriteNodeWithImageNamed:@"twitterbutton"];
        [_twitterbutton setSize:CGSizeMake(50, 50)];
        [_twitterbutton setPosition:CGPointMake(self.size.width/2, self.size.height/5 + 50)];
        //Adding the twitter button
        [self addChild:_twitterbutton];
        //Again, this is important, otherwise we can't identify what button is pressed
        _twitterbutton.name = @"twitterbutton";
        [_twitterbutton setPosition:CGPointMake(self.size.width/2, self.size.height/5 + 50)]
    }
    return self;
}


- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    //Same as in NewGameScene menu
    UITouch *touch = [touches anyObject];
    CGPoint location = [touch locationInNode:self];
    SKNode *node = [self nodeAtPoint:location];
    //Is the twitter button touched?
    if([node.name isEqualToString:@"twitterbutton"]){
        if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]){
            SLComposeViewController *tweetSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
            [tweetSheet setInitialText:@"TestTweet from the Game !!"];
            [self presentViewController:tweetSheet animated:YES completion:nil];
     **//Error:No visible @interface for 'GameOverScene' declares the selector "presentViewController":animated:completion:**
         } 
    }

ViewControlloer.m

#import "ViewController.h"
#import "NewGameScene.h"
@implementation ViewController
//Loads the view onto our main class
- (void)loadView
{
  self.view  = [[SKView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
}
//Executes when view finishes loading
- (void)viewWillLayoutSubviews
{
  [super viewDidLoad];

  //Set the resize mode to flexible width and height
  [self.view setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight];

  //Create our view from our original view
  //Make sure to leave originalContentView in, otherwise the app will crash
  SKView *skView = (SKView *)self.originalContentView;

  //We create a new NewGameScene according to the current dimensions
  SKScene *scene = [NewGameScene sceneWithSize:skView.bounds.size];

  //Create a transition class with animation type fade and a duration of .4 seconds
  SKTransition *transition = [SKTransition fadeWithDuration:.4];

  //Present the menu view (NewGameScene) with our fade in transition
  [skView presentScene:scene transition:transition];
}

@end

Antworten auf die Frage(1)

Ihre Antwort auf die Frage