Api compiled in simulator but not in iphone device

Discussion in 'iOS Programming' started by sgauravv, Aug 20, 2008.

  1. sgauravv macrumors newbie

    Jul 17, 2008
    I have used these lines in our iphone application
    NSString *uniqueID = [[UIDevice currentDevice] uniqueIdentifier];
    CFTypeRef serialNumberAsCFString;

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



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


    NSString *serial = [[NSString alloc] initWithFormat:mad:"%@",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.
  2. kainjow Moderator emeritus


    Jun 15, 2000
    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).
  3. sgauravv thread starter macrumors newbie

    Jul 17, 2008
    BUt NSDate is working and NSCalender is derived class of NSDate and from same framework.....
  4. kainjow Moderator emeritus


    Jun 15, 2000
    Not on the iPhone. There are threads on this front page that give alternatives (namely NSCalendar and NSDateComponents).

Share This Page