I read once though that if you spray a black bear with pepper spray, it will deter them for a short while, but that they might come back more aggressively. I dunno if that is the case, and don’t want to test it lol.
Predatory black bears are less likely to be deterred by spray.