In my ios app i am stuck on a task. I need to take pic from camera and save it on document directory.Problem is that i want save unique name of image.I was try to add current time with a name. but there are length problem to save image.Please suggest me how can i do that task.
Thanks
Given a proposed name like NString *name = @"Lake"
:
NSString *myUniqueName = [NSString stringWithFormat:@"%@-%u", name, (NSUInteger)([[NSDate date] timeIntervalSince1970]*10.0)];
EDIT: updated so that the only chance of a duplicate is the same original name, submitted within 100 ms of the first (virtually impossible in my opinion, if this is a concern use 100 instead of 10)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With