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!
Explore posts in the same categories: App Store, iPhone, iPhone SDK, technologyTags: App Store, iPhone, Reachability
You can comment below, or link to this permanent URL from your own site.
Leave a Reply