iPhone Dev: Button for iPhone (not Touches)

The App Store rejected my first attempt at submitting an app based on “Reachability” (which I’m still trying to resolve) and showing a call button (even to devices incapable of placing a call, such as iPod Touches). Turns out what I was looking for is somewhat easy… at least the part that checks if the device is capable of calls. See code below:

- (BOOL)deviceCanMakePhoneCalls
{
    BOOL canMakePhoneCalls;
    if ([UIApplication instancesRespondToSelector:@selector(canOpenURL:)]) {
        // OS 3.0, so use canOpenURL
        UIApplication *app = [UIApplication sharedApplication];
        canMakePhoneCalls = ([app canOpenURL:[NSURL URLWithString:@"tel:+44-1234-567890"]]);
    } else {
        // OS 2.x, so check for iPhone
        UIDevice *device = [UIDevice currentDevice];
        canMakePhoneCalls = ([device.model isEqualToString:@"iPhone"]);
    }
    return canMakePhoneCalls;
}

What this doesn’t do is show the button (or hide it). Now, if you know how to solve for any this more elegantly… please, do tell. AND… if you’d like to help me via ichat or Google Chat to walk through the Reachability issue… lemme know!

Advertisements
Explore posts in the same categories: App Store, iPhone, iPhone SDK, technology

Tags: , ,

You can comment below, or link to this permanent URL from your own site.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: