I am developing one iOS 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.
This will generate the random key
NSTimeInterval today = [[NSDate date] timeIntervalSince1970];
NSString *intervalString = [NSString stringWithFormat:@"%f", today];
NSDate *date = [NSDate dateWithTimeIntervalSince1970:[intervalString doubleValue]];
NSDateFormatter *formatter=[[NSDateFormatter alloc]init];
[formatter setDateFormat:@"yyyyMMddhhmm"];
NSString *strdate=[formatter stringFromDate:date];