I currently have a Spritekit-based game up on the App Store called Lil' Softy and it uses the Social Framework. I have two buttons in the app that allow the user to share to Facebook and Twitter. For some reason when I touch the Facebook button, the initial text that I have coded does not display, but it displays perfectly for the Twitter button. I've been trying for hours to figure out why this is happening and I can't seem to understand.
This is the code that runs when the Twitter or Facebook button is tapped:
func shareToFacebook(){
var currentPoints = DDPointsLabel(num:NSUserDefaults.standardUserDefaults().integerForKey("points"))
var currentPointsNumber = currentPoints.number
var shareToFacebook: SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeFacebook)
shareToFacebook.setInitialText("Just caught \(currentPointsNumber) tears in #LilSofty https://itunes.apple.com/us/app/lil-softy/id1027535939?mt=8")
shareToFacebook.addImage(UIImage(named: "LilSofty1024.png"))
let vc: UIViewController = self.view!.window!.rootViewController!
vc.presentViewController(shareToFacebook, animated: true, completion: nil)
}
func shareToTwitter(){
var currentPoints = DDPointsLabel(num:NSUserDefaults.standardUserDefaults().integerForKey("points"))
var currentPointsNumber = currentPoints.number
var shareToTwitter: SLComposeViewController = SLComposeViewController(forServiceType: SLServiceTypeTwitter)
shareToTwitter.setInitialText("Just caught \(currentPointsNumber) tears in #LilSofty https://itunes.apple.com/us/app/lil-softy/id1027535939?mt=8")
shareToTwitter.addImage(UIImage(named: "LilSofty1024.png"))
let vc1: UIViewController = self.view!.window!.rootViewController!
vc1.presentViewController(shareToTwitter, animated: true, completion: nil)
}
This is what it shows when I tap the Twitter button: https://i.stack.imgur.com/b2qgR.jpg
And this is what it shows when I tap the Facebook button: https://i.stack.imgur.com/HAKRS.jpg
If anyone has any explanation for this please let me know, or let me know if I need to supply more information.
An update to the Facebook application has replaced the in-built Facebook share activity with one that ignores status text - If you remove the Facebook app from your device the text will be displayed using the code you have. If you have the Facebook app installed you get images, URLs but not the text.
Follow the instructions: https://developers.facebook.com/docs/sharing/ios
Then you can do something like this:
Share a link
Share Photos
Photos must be less than 12 MB in size
Share Video on Facebook
Videos must be less than 12MB in size. I hope I have helped you. (Sorry for my english)