How to detect if the phone app is available for various devices using iphone os

此生再无相见时 提交于 2019-12-03 15:04:48

问题


I'd like to show or hide a button that lets a user make a phone call based on whether or not the user can actually make a call (iPhone or iPod touch). Is it possible to somehow detect if the phone app is available to the user in cocoa-touch? Or am i constrained to detecting the device type to make that distinction? I would rather check for functionality than static clients in case something changes down the line for whatever reason (not that iPod touch users could ever make non-voip phone calls anyways, but the code would be cleaner).


回答1:


BOOL canMakePhoneCalls = [[UIApplication sharedApplication]
                           canOpenURL:[NSURL URLWithString:@"tel:5555555"]];


来源:https://stackoverflow.com/questions/1395224/how-to-detect-if-the-phone-app-is-available-for-various-devices-using-iphone-os

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!