Apple is telling to do so in this document over here, and here.
I’d hate to re-invent the wheel and am sure someone did this already, but I wasn’t lucky with Google. Does someone know a blog that points out how to do exactly that?
The problem is, I must create this directory with the app bundle ID name inside Library but only if it does not exist.
I think this is what you are looking for: