NSFileManager unique file names

前端 未结 9 1958
生来不讨喜
生来不讨喜 2020-12-23 10:54

I need a quick and easy way to store files with unique file names on iOS. I need to prefix the file with a string, and then append the generated unique identifier to the en

9条回答
  •  感动是毒
    2020-12-23 11:42

    This should probably work for you:

    http://vgable.com/blog/2008/02/24/creating-a-uuid-guid-in-cocoa/

    The author of the post suggests implementing a 'stringWithUUID' method as a category of NSString. Just append a GUID generated with this method to the end of the file name that you're creating.

提交回复
热议问题