Search code examples
swiftwatchkit

Share image On facebook in watchKit using the Social sdk


i want share the image on Facebook in iWatch kit now problem occur in one line need help

 if  SLComposeViewController.isAvailableForServiceType(SLServiceTypeTwitter)       {         var twitterSheet:SLComposeViewController =      SLComposeViewController(forServiceType: SLServiceTypeTwitter)
            twitterSheet.setInitialText("Share on Twitter")
       self.presentViewController(twitterSheet, animated: true, completion: nil)
   }

Now problem in last line code the error is this classname does not have a member name presentViewController


Solution

  • There's a few issues here:

    • WatchKit does not include the Social framework.
    • WKInterfaceController does not include the method presentViewController.

    You may want to look into using Handoff to share the item from the user's phone, instead.