Convert short piece of code from Objective C to Swift 3

Completado Publicado hace 7 años Pagado a la entrega
Completado Pagado a la entrega

I need the code below from [login to view URL]

converted from Objective C to Swift

/*

In iOS, use the value returned by the identifierForVendor property of UIDevice as the computer’s GUID.

To compute the hash, first concatenate the GUID value with the opaque value (the attribute of type 4) and the bundle identifier. Use the raw bytes from the receipt without performing any UTF-8 string interpretation or normalization. Then compute the SHA-1 hash of this concatenated series of bytes.

*/

NSUUID *vendorIdentifier = [[UIDevice currentDevice] identifierForVendor];

uuid_t uuid;

[vendorIdentifier getUUIDBytes:uuid];

NSData *vendorData = [NSData dataWithBytes:uuid length:16];

// concacentate data for vendor identifier, opaque value and bundle identifier

NSMutableData *hashData = [NSMutableData new];

[hashData appendData:vendorData];

[hashData appendData:[login to view URL]];

[hashData appendData:[login to view URL]];

// calculate SHA1

NSData *hash = [hashData dataWithSHA1Hash];

if (![hash isEqualToData:[login to view URL]])

{

DTLogDebug(@"Incorrect SHA1 hash in receipt");

return YES;

}

Objective C Swift

Nº del proyecto: #12749380

Sobre el proyecto

2 propuestas Proyecto remoto Activo hace 7 años

Adjudicado a:

Smart1902

Dear client, I have gone through your job description & understand requirements. I will be glad to share my expertise with you. ***Apple Latest IOS10 Features*** Facebook/Twitter/Google Api***Google MapKIt***Video/A Más

$35 USD en 1 día
(31 comentarios)
6.4