Why is my custom UIActivity no longer visible in a UIActivityViewController?

104 Views Asked by At

I have created a custom UIActivity and it was working, and I presented that UIActivityController as per typical tutorials (e.g. here). When configuring that controller I disabled basically all the services:

    let items = [location]
    
    let googlemaps = GoogleMapsActivity()
    let applemaps = AppleMapsActivity()
    
    let ac = UIActivityViewController(activityItems: items, applicationActivities: [googlemaps, applemaps])
    ac.excludedActivityTypes = [.addToReadingList, .assignToContact, .markupAsPDF, .openInIBooks, .postToFacebook, .postToFlickr, .postToVimeo, .postToWeibo, .postToTwitter, .postToTencentWeibo, .print, .saveToCameraRoll]
    present(ac, animated: true)

Then I might have stumbled onto an iOS Bug?

When that activity view controller was visible I tapped on "More", which gave me a list of my 2 custom activities. There was no UISwitch to turn them on an off, but there was a typical "row handle" as in a UITableView. I was testing, and tried re-arranging rows. This made one of the activities disappear from that list and now that activity is gone forever.

It won't appear in a list again, even if I delete and re-install the app. It seems I permanently removed the ability for this iOS device to make use of that UIActivity.

What have I done wrong or how can I fix it?

1

There are 1 best solutions below

0
On

It might have had something to do with these 2 custom activities ultimately sharing the same UIActivity.ActivityType rawValue. I refactored that so they have different values and the issue doesn't seem to occur anymore, or I haven't been able to reproduce it.