Search code examples
iosswifttwitter

Tweet button enabled by default When Text is more than 280 characters in Twitter share extension


Tweet button enabled by default When Text is more than 280 characters in Twitter share extension.

Twitter can only tweet 280 characters.

Expected behaviour : Tweet button should be disabled by default if characters is more then 280

let shareText = delegate.shareText() // Text is more then 280 characters

if let shareURL = URL(string: url) 
var objectsToShare = [shareText, shareURL]

let activityVC = UIActivityViewController(activityItems: objectsToShare as [AnyObject], applicationActivities: nil)
    if (activityVC.popoverPresentationController != nil) {
        activityVC.popoverPresentationController!.sourceView = shareButton
    }

    parentVC.present(activityVC, animated: true, completion: nil)
}

Solution

  • This isn't really a programming-related question since it's neither your fault nor Apple's. Once upon a time, the Twitter share sheet was provided by the system, this, however, changed a few years ago.

    Now, the share sheet is delivered in conjunction with Twitter's native iOS app, so if it doesn't do the button highlighting properly, it's a bug in their app and shouldn't be your worry. You can nonetheless contact them and ask them to fix it.