On 13 May 2010 14:00, John Pannell <[email protected]> wrote: > Hi Tharindu- > > In the past, I have used a UUID for this purpose. You could add the > following method to a category on NSString to make it quite easy: > > + (NSString*) stringWithNewUUID > { > CFUUIDRef uuidObj = CFUUIDCreate(nil); > NSString *newUUID = (NSString*)CFUUIDCreateString(nil, uuidObj); > CFRelease(uuidObj); > return [newUUID autorelease]; > } > > Then, you could just call [NSString stringWithNewUUID] every time you needed > a new unique string. > > Hope this helps! > > John > > On May 13, 2010, at 6:48 AM, Tharindu Madushanka wrote: > >> Hi, >> >> I want to generate a unique string every time i push a button. Can I create >> some string like that using a time stamp NSDate object may be. >> >> ex. e3df44646ngfd5454nrteter >> >> Its really useful to know about a small code segment or way to create a >> unique string in iPhone. >> >> Thank you and Kind Regards, >> >> Tharindu >
It might be simpler to just use [[NSProcessInfo processInfo] globallyUniqueString] -Jonathan _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
