Edinburgh is one place I personally tend to be very nervous about toilets because many have been closed.
However there is something called The Edinburgh Community Toilets Scheme where various shops, public buildings etc make their facilities available for general use for free- https://consultationhub.edinburgh.gov.uk/sfc/public-toilets-survey/supporting_documents/Public%20Toilets%20Map.pdf
(this map is from 2015). There could be much better mapping and publicity of this, but the toilet map website I cited above has at least some (from sampling), maybe all, of them on.
Up and down the UK such Community schemes exist- it is knowing about them.
In my home town in England of 25,000 people we have no public toilets left, although new ones are to open later this year (in the daftest possible place). This is a constant local complaint, especially as we try to expand tourism and attract cruise ships back.
(Yes we would like more tourists and we would like to return to having cruise ship calls, as we know their economic benefits, ours were always smaller ships, not the mega sized ones)
Funnily enough there was a local facebook spat here about toilets last night. The previous Mayor pointed out forcefully and correctly that there are free publicly accessible ones at the two main town supermarkets, the department store, the local council office and one of the two museums. The thing is that without the map or some app the casual visitor would not be aware of any of those. The Mayor says we now have more facilities than when the public toilet blocks were open- he may be right and they are certainly better quality. To that list I would add the Wetherspoons pub as well!!
Never assume that an app is better than a website. Both depend on what has been input into them.
And my late father had Crohn's so I know where you are coming from.
So really back to planning places to visit.