Xcode 8 beta 6 UIActivityItemProvider error with @objc compatibility

149 views Asked by At

Trying to implement a UIActivityItemProvider in Xcode 8 beta 6. After changing this method from a String parameter to UIActivityType, now get this error:

Method cannot be an @objc override because the type of the parameter 2 cannot be represented in Objective-C.

Is this a bug? Is there a workaround?

Here is our code

class NotificationUIActivityItemProvider : UIActivityItemProvider {

let subject : String
let text : String

init(subject: String, text: String) {

    self.subject = subject
    self.text = text
    super.init(placeholderItem: subject)
}

override public var item: Any { return text }

override func activityViewController(_ activityViewController: UIActivityViewController, subjectForActivityType activityType: UIActivityType?) -> String {
    if activityType == .mail {
        return subject
    } else {
        return ""
    }
}

}

1

There are 1 answers

0
Jason Hocker On BEST ANSWER

This is now working after we solved more Xcode 8 beta 6 errors.