JavaScript and iOS Communication solutions

Source: Internet
Author: User

After 1.5, the idea of a JavaScript and iOS newsletter was finally realized (I don't know if anyone had already done it before).

Remember that early iOS embedded HTML in the communication, the seemingly good way is only iOS through the URL to intercept the page to send messages, but so if the page frame on the URL is more dependent on the problem, and frequent change url,ios may not be able to intercept the URL each time.

A foreigner wrote a set of uses this method to realize the JS and the iOS Communication Library, the principle is basically still so. However, seemingly done optimization, the transformation of the URL is not in the webview, but the back end ran a webview specifically deal with the changes in the URL, I did not in-depth research. This solves a part of the problem, but it sounds uncomfortable to me.

Later in the iOS collaboration, I heard that JavaScript launched the alert method that iOS can rewrite. It was a smart one, so why not rewrite alert as an entrance to the message? So as long as the agreed good message mode (such as alert a parameter for general alert, multiple representative messages), so that JS can not directly communicate with iOS? The iOS side simply registers the multiple-medium method to process the communication message.

Because I basically did not dabble in iOS, so at that time to find someone to prove, but some said can not be achieved, some say there are problems, some also said that can be achieved but ultimately did not give me to achieve .... Then after iOS7 out, heard that the original Alertview method changed, then feel fast to give up.

Things shelved to this day, and finally our iOS department manager listened to my idea, very agree that can be a try. I said iOS7 's concerns, and he said it was just a different method. Not long ago, I waited before and after 1.5 of the communication protocol has finally come true! and verification can, advantages and disadvantages I will not say, we want to know! Special record to commemorate!

I regret that I did not study iOS.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.