Chcę poznać numer seryjny mojego iPhone'a za pomocą mojej aplikacji. Mam napisany kod poniżej.Jak programowo uzyskać numer seryjny iPhone'a?
- (NSString*)getSerialNumber
{
CFTypeRef serialNumberAsCFString;
io_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice"));
if (platformExpert)
{
serialNumberAsCFString = IORegistryEntryCreateCFProperty(platformExpert, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0);
}
IOObjectRelease(platformExpert);
NSString *serial = [[NSString alloc] initWithFormat:@"%@",serialNumberAsCFString];
NSLog(@"serail no==>%@",serialNumberAsCFString);
NSLog(@"serail no==>%@",serial);
}
Dlaczego wciąż otrzymuję błędny numer seryjny?
Co to znaczy "zły numer seryjny"? Czy to nie jest wyświetlane, czy tylko niepoprawne? –
potrzebujesz numeru seryjnego lub UUID? Dokumenty Apple mówią, że UUID jest unikalny wśród wszystkich urządzeń i że powinieneś używać takiego numeru zamiast numeru seryjnego urządzenia. – balexandre
jest zaakceptowany przez Apple Store? – iKT