PDA

View Full Version : Api compiled in simulator but not in iphone device




sgauravv
Aug 20, 2008, 08:09 AM
hi
I have used these lines in our iphone application
NSString *uniqueID = [[UIDevice currentDevice] uniqueIdentifier];
CFTypeRef serialNumberAsCFString;

io_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault,IOServiceMatching("IOPlatformExpertdevice"));

if(platformExpert)

{

serialNumberAsCFString = IORegistryEntryCreateCFProperty(platformExpert, CFSTR(kIOPlatformSerialNumberKey), kCFAllocatorDefault,0);

}
IOObjectRelease(platformExpert);

NSString *serial = [[NSString alloc] initWithFormat:@"%@",serialNumberAsCFString];

now when i am compiling this code in iphone simulator it is working fine...
but when i am compiiling in iphone device that it is giving an error that these lines are undeclared.
same problem is also coming when I am using NSCalenderDate.
it is working fine in simulator but in device it is undeclared

May I know why it is so??
please help me.



kainjow
Aug 20, 2008, 11:35 AM
IOKit isn't available on the iPhone. The simulator doesn't use the same frameworks as the iPhone. NSCalenderDate isn't available on the iPhone either (search around, there are a few threads on this).

sgauravv
Aug 20, 2008, 12:34 PM
hi.........
BUt NSDate is working and NSCalender is derived class of NSDate and from same framework.....

kainjow
Aug 20, 2008, 06:27 PM
Not on the iPhone. There are threads on this front page that give alternatives (namely NSCalendar and NSDateComponents).