As a technical matter, many non-profits have a lousy history of serving the public.
Suppose the software license designates the "Dalke Foundation" as the primary recipient of the charity. I, as the organizer of the foundation, decide that I get US$80,000 as income for working at the organizer, and the rest is disbursed to the local animal shelter.
This is acceptable, legally. While probably not what you intend for the license, it seems like a good way for me to make some tax-free money.
Here is another technical difficulty. What if I am a company, who integrates source which earmarks 8 different non-profits. I charge $100/copy, I make 30 sales per month of which 30% goes to Apple, some goes to taxes, and some goes to my salary. What is the right way to split that revenue? Is it a fixed value per non-profit, a fixed percentage of profit to each non-profit (giving me inventive to raise my own salary and lower the profit), or a fixed percentage of profit which is shared equally to all 8 non-profits?
This is even worse than the "obnoxious BSD advertising clause" https://www.gnu.org/philosophy/bsd.html .
Some other tricky points: is there an internationally useful definition of "non-profit"? Can Scientology, which is a non-profit in the US but not in Germany, use the software? Also, don't forget that the non-profit might cease to exist. Can commercial users of the software use software which requires a fee payment when there's no one to accept the money?
What happens if the non-profit refuses to accept the money? (For example, a local youth support non-profit might decline to accept money from an organization which advocates for the removal of pedophilia laws.) Can that commercial organization still be able to use the software?
If the software is free, and most of the revenue comes from in-app purchases, then does that count? Or is it only software sales which count? What about support fees?
These are the problems which easily spring to mind. I'm sure you can come up with more difficulties with the scheme.