3

I have an app that in contact us section allows the user to call us depending on the device. If it is an iPhone it would show the number along with the Call button. If it is an iPod Touch it would just display the number. But since updating to iOS8 the iPod Touch is also being identified as an iPhone and is showing the Call button. Anybody know how to fix this? Any help is appreciated.

Abin Jose
  • 31
  • 1

2 Answers2

4

You can check to see if the iOS device can open a telephone link:

if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"tel:+11111"]])

As mentioned in the following post:

How do I test if IOS device has telephone capabilities?

Community
  • 1
  • 1
Adam Richardson
  • 2,518
  • 1
  • 27
  • 31
1

Do device type check as below :

- (NSString *) deviceType{
    NSString *devicePlatform = [self deviceModel];
    if ([devicePlatform isEqualToString:@"iPod1,1"])      return @"iPod Touch 1G";
    if ([devicePlatform isEqualToString:@"iPod2,1"])      return @"iPod Touch 2G";
    if ([devicePlatform isEqualToString:@"iPod3,1"])      return @"iPod Touch 3G";
    if ([devicePlatform isEqualToString:@"iPod4,1"])      return @"iPod Touch 4G";
    if ([devicePlatform isEqualToString:@"iPad1,1"])      return @"iPad";
    if ([devicePlatform isEqualToString:@"iPod5,1"]) return @"iPod Touch 5G";

    return devicePlatform;
}
- (NSString *) deviceModel{
    size_t size;
    sysctlbyname("hw.machine", NULL, &size, NULL, 0);
    char *machine = malloc(size);
    sysctlbyname("hw.machine", machine, &size, NULL, 0);
    NSString *platform = [NSString stringWithUTF8String:machine];
    free(machine);
    return platform;
}