简体   繁体   中英

How can I pull iPhone contacts into UIWebView?

I'm trying to find a way to import iPhone native contacts onto a UIWebView page. Users should be able to tap a button on the web view to pull up list of phone contacts and then choose some contacts from that list. Once they're done selecting contacts, the UIWebView must show all contacts selected (contact info could be names, phone number, email, etc).

I read about intercepting requests made from UIWebView by using UIWebViewDelegate and it looks promising as far as going from UIWebView to some native view. But how do I bring the data from native view into the UIWebView?

You can look at using UIWebView's stringByEvaluatingJavaScriptFromString:(NSString *)script to inject address book data as a JSON string into your webpage.

I think the hardest part for you will be extracting all the address book data into a formatted JSON string.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM