I am developing one iPad application using storyboard and core data.For my application i need to generate one random string like 'M000142140502343524' which are not already exist in the 'data' field of the 'tableA' when click a button.
Common way to generate an unique string is
NSString *UUID = [[NSUUID UUID] UUIDString];
or
NSString *identifier = [[NSProcessInfo processInfo] globallyUniqueString];
But you also could create such string yourself. For example:
+ (NSString *)createRandomName
{
NSTimeInterval timeStamp = [ [ NSDate date ] timeIntervalSince1970 ];
NSString *randomName = [ NSString stringWithFormat:@"M%f", timeStamp];
randomName = [ randomName stringByReplacingOccurrencesOfString:@"." withString:@"" ];
return randomName;
}