I see you have many responses to your post, which I will eventually read, but I want to offer my own thoughts while they’re fresh.
Fortunately I’ve never experienced anything like this while iNatting. (While taking an architectural photo, yeah… and it was a commercial building on literal Main Street.) But I know women who are somewhere between reluctant and afraid to go on nature walks alone, so you are not alone in your concerns. If it makes you more comfortable, go with a friend or a group. I do most of my nature walks with a group (we have a few active groups in my area), mostly for the companionship and because I’ve learned about places I might otherwise have missed. But I also walk alone in places where I feel comfortable.
You may be iNatting with a smart phone, but if you’re using a camera be sure to also have a cell phone with you in case you need help. (It could be a sprained ankle as easily as it was an aggressive stranger.) A whistle can help, too.
Have a story in case you run into this guy (or one like him) again. “Oh, I’m doing this for a project at my university and this camera belongs to the university. I really shouldn’t be using it for photos outside the scope of our project.” You shouldn’t need to explain yourself, but some people don’t get that.
As a last resort, take the photo. Suggest he be in the photo with his dog. Show the photo to your friends. Show the cops. Show the park rangers (if you’e in a park). Make sure everyone knows who this guy is who harassed you. And then delete the photo (assuming it’s digital).
As long as you are on public property and not doing anything illegal or creepy, you have every right to photograph wild nature and not to photograph some guy’s dog. What he did was rude and foolish, and it’s unfortunate you bore the brunt of it.