Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSString to NSUUID convert

how to convert from NSString to NSUUID ? i got the answer for conversion of, NSUUID to NSString but vice versa could not found.like this is my string @"12033030303" alloc NSUUID using this string any help would be appreciated

like image 592
Sheshnath Avatar asked Nov 11 '14 07:11

Sheshnath


1 Answers

@"12033030303" is not possible to convert to NSUUID, as Universally Unique Identifier has specification (for example look at wikipedia), this means any random string can't be converted to NSUUID.

initWithUUIDString should be the method you're looking for, but it works only if UUID is valid.

NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:@"A5D59C2F-FE68-4BE7-B318-95029619C759"];
like image 123
l0gg3r Avatar answered Nov 16 '22 03:11

l0gg3r