{"id":583,"date":"2014-06-18T13:43:26","date_gmt":"2014-06-18T05:43:26","guid":{"rendered":"http:\/\/www.yusian.com\/blog\/?p=583"},"modified":"2016-07-15T15:39:52","modified_gmt":"2016-07-15T07:39:52","slug":"ios%e9%a1%b9%e7%9b%ae%e4%b8%ad%e8%b0%83%e7%94%a8%e6%8b%a8%e5%8f%b7%e7%a8%8b%e5%ba%8f%e7%9a%84%e4%b8%89%e4%b8%aa%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/project\/2014\/06\/18\/134326583.html","title":{"rendered":"iOS\u9879\u76ee\u4e2d\u8c03\u7528\u62e8\u53f7\u7a0b\u5e8f\u7684\u4e09\u4e2a\u65b9\u6cd5"},"content":{"rendered":"<p>1\u3001<strong>openURL<\/strong>\uff0c\u5229\u7528Application\u7684openURL\u65b9\u6cd5\u5b9e\u73b0\uff0c\u62e8\u6253\u5b8c\u7535\u8bdd\u56de\u4e0d\u5230\u539f\u6765\u7684\u5e94\u7528\uff0c\u4f1a\u505c\u7559\u5728\u901a\u8baf\u5f55\u91cc\uff0c\u800c\u4e14\u662f\u76f4\u63a5\u62e8\u6253\uff0c\u4e0d\u5f39\u51fa\u63d0\u793a<\/p>\n<pre lang=\"objc\" line=\"1\">NSMutableString * str=[[NSMutableString alloc] initWithFormat:@\"tel:%@\", @\"187xxxx7135\"];\n\n[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];<\/pre>\n<p>2\u3001<strong>UIWebView<\/strong>\uff0c\u5229\u7528WebView\u8bf7\u6c42RUL\u6765\u5b9e\u73b0\uff0c\u6253\u5b8c\u7535\u8bdd\u540e\u8fd8\u4f1a\u56de\u5230\u539f\u6765\u7684\u7a0b\u5e8f\uff0c\u4e5f\u4f1a\u5f39\u51fa\u63d0\u793a\uff0c\u63a8\u8350\u8fd9\u79cd<\/p>\n<pre lang=\"objc\" line=\"1\">NSMutableString * str=[[NSMutableString alloc] initWithFormat:@\"tel:%@\", @\"187xxxx7135\"];\n\n    UIWebView * callWebview = [[UIWebView alloc] init];\n\n    [self.window addSubView:callWebvew];\n\n    [callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];<\/pre>\n<p>3\u3001<strong>openURL<\/strong>\uff0c\u7b2c\u4e00\u79cd\u65b9\u5f0f\u7c7b\u4f3c\uff0c\u8fd9\u79cd\u65b9\u6cd5\u4e5f\u4f1a\u56de\u53bb\u5230\u539f\u6765\u7684\u7a0b\u5e8f\u91cc\uff08\u6ce8\u610f\u8fd9\u91cc\u7684<strong>telprompt<\/strong>\uff09\uff0c\u4e5f\u4f1a\u5f39\u51fa\u63d0\u793a<\/p>\n<pre lang=\"objc\" line=\"1\">NSMutableString * str=[[NSMutableString alloc] initWithFormat:@\"telprompt:\/\/%@\", @\"187xxxx7135\"];\n\n    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]]<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001openURL\uff0c\u5229\u7528Application\u7684openURL\u65b9\u6cd5\u5b9e\u73b0\uff0c\u62e8\u6253\u5b8c\u7535\u8bdd\u56de\u4e0d\u5230\u539f\u6765\u7684\u5e94\u7528\uff0c\u4f1a\u505c\u7559\u5728\u901a\u8baf\u5f55\u91cc\uff0c\u800c\u4e14\u662f\u76f4\u63a5\u62e8\u6253\uff0c\u4e0d\u5f39\u51fa\u63d0\u793a NSMutableString * str=[[NSMutableString alloc] initWithFormat:@&#8221;tel:%@&#8221;, @&#8221;187xxxx7135&#8243;]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]]; 2\u3001UIWebView\uff0c\u5229\u7528WebView\u8bf7\u6c42RUL\u6765\u5b9e\u73b0\uff0c\u6253\u5b8c\u7535\u8bdd\u540e\u8fd8\u4f1a\u56de\u5230\u539f\u6765\u7684\u7a0b\u5e8f\uff0c\u4e5f\u4f1a\u5f39\u51fa\u63d0\u793a\uff0c\u63a8\u8350\u8fd9\u79cd NSMutableString * str=[[NSMutableString alloc] initWithFormat:@&#8221;tel:%@&#8221;, @&#8221;187xxxx7135&#8243;]; UIWebView * callWebview = [[UIWebView alloc] init]; [self.window addSubView:callWebvew]; [callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]]; 3\u3001openURL\uff0c\u7b2c\u4e00\u79cd\u65b9\u5f0f\u7c7b\u4f3c\uff0c\u8fd9\u79cd\u65b9\u6cd5\u4e5f\u4f1a\u56de\u53bb\u5230\u539f\u6765\u7684\u7a0b\u5e8f\u91cc\uff08\u6ce8\u610f\u8fd9\u91cc\u7684telprompt\uff09\uff0c\u4e5f\u4f1a\u5f39\u51fa\u63d0\u793a NSMutableString * str=[[NSMutableString alloc] initWithFormat:@&#8221;telprompt:\/\/%@&#8221;, @&#8221;187xxxx7135&#8243;]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[20,17],"class_list":["post-583","post","type-post","status-publish","format-standard","hentry","category-project","tag-basics","tag-skill"],"_links":{"self":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/583","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/comments?post=583"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/583\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=583"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=583"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=583"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}