iphonephone-callipod-touch

How to disable phone Call button only for iPod touch by xcode coding?


In my application I am showing business card as detail of showroom. In that detail I have given phone call option to user.

From iPhone we can call to respective number by giving code as follows..

 NSString* call = [NSString stringWithFormat:@"tel:%@",phone_number];
NSURL* url = [[NSURL alloc] initWithString:[call  stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
[[UIApplication sharedApplication] openURL:url];

But from iPod I think we can not give phone call to respective number.

Now I want to launch application for iPhone and iPod but if I set Required device capabilities as "telephony" then App will not work on iPod. If I do not mention Required device capabilities as telephony and submit app as it is, will it be OK for Apple review process? This will lead to have Phone call button on iPod with no function.

My question is how to disable phone call button and change text programmatically if user will install app on iPod?


Solution

  • I believe your app will not be in violation of guidelines if it degrades gracefully. You only need to declare device capability requirements if your app completely refuses to run without it.

    From iOS App Programming Guide (emphasis mine):

    If your app requires the presence or absence of specific device capabilities in order to run, you must declare those requirements using the UIRequiredDeviceCapabilities key in your app’s Info.plist file. At runtime, iOS cannot launch your app unless the declared capabilities are present on the device. Further, the App Store requires this information so that it can generate a list of requirements for user devices and prevent users from downloading apps that they cannot run

    For determining if the app can respond to tel:// urls, see How do I test if IOS device has telephone capabilities? You essentially use canOpenURL to determine if a phone call can be made.