有没有人在 iOS 8.3 上遇到过 UIActivityController 这个情况? 是系统 Bug 吗 ?

2 views
Skip to first unread message

猪头 Zhu

unread,
Apr 22, 2015, 10:27:24 PM4/22/15
to iOSDe...@googlegroups.com

strange bug

We can clearly see that a item in .Action of UIActivityCategory disappear when the action done in gif.

Here is my code:

class SAActivity: UIActivity {
var saActivityTitle:String = ""
var saActivityImage:UIImage! = UIImage()
var saActivityFunction: (() -> Void)?
override func activityType() -> String {
    return ""
}
override func activityTitle() -> String  {
    return saActivityTitle
}
override func activityImage() -> UIImage {
    return saActivityImage
}
override func canPerformWithActivityItems(activityItems: [AnyObject]) -> Bool {
    return true
}
override func prepareWithActivityItems(activityItems: [AnyObject]) {
    saActivityFunction!()
}
override class func activityCategory() -> UIActivityCategory {
   return .Action
}
override func performActivity() {

}

}

Here is how to init

    //edit button 
    var editActivity = SAActivity()
    editActivity.saActivityTitle = "edit"
    editActivity.saActivityImage = UIImage(named: "edit")!
    editActivity.saActivityFunction = {
        //
        Foo()
    }

    //delete button 
    var deleteActivity = SAActivity()
    deleteActivity.saActivityTitle = "delete"
    deleteActivity.saActivityImage = UIImage(named: "goodbye")!
    deleteActivity.saActivityFunction = {
        Foo()
    }

Then I add the two items to activityViewController

     self.activityViewController = UIActivityViewController( activityItems: [ content[0], url, image ],
      applicationActivities: ActivityArray)

     self.activityViewController?.excludedActivityTypes = [
            UIActivityTypeAddToReadingList, UIActivityTypeAirDrop, UIActivityTypeAssignToContact, UIActivityTypePostToFacebook, UIActivityTypePostToFlickr, UIActivityTypePostToVimeo, UIActivityTypePrint //, UIActivityTypeCopyToPasteboard
        ]

So, what has been show in gif is wired, How to fix it ?
PS: Only be wrong on iOS 8.3.

Reply all
Reply to author
Forward
0 new messages