0

in a SpriteKit game I want to integrate facebook and twitter. I tried:

            if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) {


                SLComposeViewController *tweetSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
                [tweetSheet setInitialText:@"love luvlee"];

            }

but i can't present it using:

[self presentViewController:tweetSheet animated:YES completion:nil]; 

what could be the reason for that?

user3138007
  • 637
  • 1
  • 6
  • 19

1 Answers1

0

SpriteKit does not have the method [self presentViewController:tweetSheet animated:YES completion:nil];. Only view controllers can do that.

Your solution is to either get a reference to the view controller or add a method to the view controller that does the posting for you and you simply pass the desired values to.

sangony
  • 11,636
  • 4
  • 39
  • 55
  • how do i get such a reference? – user3138007 May 17 '14 at 15:03
  • @user3138007 - You can create a VC class property for the SKScene in question and pass the VC 'self' as you init your SKScene. – sangony May 17 '14 at 15:12
  • can somebody please post some sample code .. i am quite new to xcode and do not know how to do it .. – user3138007 May 17 '14 at 18:16
  • @user3138007 - That's a different question all together. I suggest you post a new question specifically related to this. – sangony May 17 '14 at 18:45
  • @user3138007 - I came across 2 links that might provide you with some useful help: http://stackoverflow.com/questions/22421252/how-do-i-present-uiviewcontroller-from-skscene-with-social-framework – sangony May 17 '14 at 22:39
  • @user3138007 - and this link: http://www.raywenderlich.com/forums/viewtopic.php?f=21&t=10721 – sangony May 17 '14 at 22:39