开发者

Can I let a user select a contact from his iPhone's contact list in a web application?

开发者 https://www.devze.com 2022-12-19 00:35 出处:网络
So that only a s开发者_如何学JAVAingle contact is passed to the web application with the explicit permission of the user..hum, in a \"pure web app\" (that you access from a URL in the mobile safari) I

So that only a s开发者_如何学JAVAingle contact is passed to the web application with the explicit permission of the user..


hum, in a "pure web app" (that you access from a URL in the mobile safari) I don't think you can. However, you can :

  • embed a UIWebView (that accesses your webapp url) into a native app
  • when the user clicks in your webapp on a HTML button "contacts", you open a page with a custom protocol (let's say myapp://contacts)
  • then, in the delegate of the UIWebView, the callback shouldStartLoadWithRequest will be invoked. Check that the scheme of the URL from the NSURLRequest corresponds to myapp://contacts and based on that, trigger the opening of the ABPeoplePickerNavigationController to enable the selection of a "native" contact.
  • once the contact has been selected (delegate of the previous controller), you reinject this selection into your UIWebView using [myWebView stringByEvaluatingJavascriptFromString:myJsFunctionToInjectContactInfo

I'm using this approach and it works fine.

0

精彩评论

暂无评论...
验证码 换一张
取 消