Your code is fine, as long as it saves the photo (didn't test your code).
I came across the same issue as you described and after some testing i noticed that the same photo data is only renamed once. I also noticed that if you change anything in the photo data then renaming and saving file works just fine.
I managed to rename file succesfully by setting some random value in EXIF data, just choose any EXIF data key that is most useless to you.
I think iOS has some kind of duplicate recognition handling, because any change in data and renaming works just fine.
I also don't think that it's good way of doing this thing. But couldn't find anything that worked.