To the Cordova WebApp development: (6) How to write a plugin for getting the app version number under iOS? "So far, we've largely learned how to use Cordova, and those are the necessary skills for developers using Cordova." Today we're going to talk about some of the extra experience that developers should have, which is simple and effective, and if you want a more systematic and better approach, keep focusing on this series of articles and grow with agile individuals.
What you can learn from this exercise
- Learn how to fix bugs by not publishing apps on the fly
- Learn how to add features dynamically
- Learn how to dodge some of Apple's rigorous audits
How to fix bugs by not publishing apps dynamically
Do the site know, fix the bug is very convenient, as long as the change a site, all access to this site people use the latest version. In fact, this is not a stranger to do PC-side products, we all do automatic upgrade, that is, the client will be launched when the start check whether the latest version of the server to provide, and some will automatically download updates. This is also the traditional way for Android and iOS native apps to check for updates.
For some native app developers who are good at thinking and optimizing operations, they want to do incremental updates, that is, downloading the server's resources to the phone, eliminating the need to reinstall the app, which requires some technical content. Fortunately, the rise of Web apps now allows people to make apps and also consider whether they can be dynamically updated like Web sites. Do not say new features, at least to be able to dynamically fix the bug it?
If you have this idea, then some of the next tips may be useful. This does not require you to have any technical content, I put out the code, you will be higher than the average person experience.
In the Palm of the broad, I am not enough staff, testing strength in the current team composition is certainly not enough, I would like to ensure a rapid response, can be found in the problem immediately after the repair?
Although I used the Web app in the past few years to do the agile personal application, but basically very little thought on the above to think about technical issues, but do the product is not the same, this is not only interest, but also to bear the responsibility. So you start thinking about how you can fix bugs without republishing your app?
It takes time and effort to make things perfect or extreme. I do not have much time, so I can only think of a relatively simple, but relatively effective, can solve a certain type of problem solution, the final thought of the solution is very simple and effective, simply speaking, in Cordova each page calls a server-side script, this script can be rewritten and new functions, If you find a bug in a previously written function, rewrite the function and publish it to the Web server. In this case, the user-installed app does not need to be reinstalled and will call the updated function body.
It is not easy to say, if you do not understand, it does not matter, then I will post some code, so you will be more aware of what I am talking about.
The above is a "select City" in the Palm-wide app, and a bug was omitted when it was released. Everything is fine under Andorid, but there is a strange phenomenon posted on iOS. That is, after entering B, the soft keyboard disappears so that it can no longer enter J. This question has been tossing me for two days, then very depressed. Tried a lot of steps did not find the problem, and finally found that the original problem is the company's statistical platform of a JS code caused, this is not specifically said, not the focus of this article. The point is I found the problem, and know how to modify, now how to fix let the user immediately normal use of the problem?
Release Andorid Fortunately, iOS that's not what you said released on the release, the audit cycle generally two weeks, out of the question let you audit not through one months can only be sent once, if only because of the change of a bug sent once, the price is too big, but if not released, so that users with one months of error software, the cost is greater, The user churn rate is bound to soar. So how do I fix this problem at once?
Look at the code, enter the event code in the city input box as shown, there is a function inputcitykeyword in scj.js. The fix to this problem is that I commented out the line of code in this code, that is, no statistics.
What I'm doing now is rewrite this function inputcitykeyword in another called Scjex.js,
Now you must be curious, what does this scjex.js file have to do with scj.js?
At the end of the Scj.js file, I have a line of code like this
$.getscript ("http://" has gone to the address of my work, here is your specific URL "/www/js/app/scjex.js");
To understand the meaning of this code, you need to understand the jQuery.getScript() function first. This function is used to load a JavaScript file in HTTP Get form and run it . You can dynamically load the JS file and execute the JS code in the file at the global scope. This JS code can be the function can asynchronously load the cross-domain JS file.
Understand this function should know that I write this sentence, in fact, in order to let Cordova load business js, load the execution of a server JS.
The next thing is interesting.
What do you think the program will do if all two files have functions with the same name? If you don't know the answer, you can try it yourself. Did you understand how I did not republish the app to fix the bug? If you do not understand, and then look again, this must understand, or later series out more complex and more perfect incremental update, it is more difficult to understand. (In fact, incremental update, I still have no time to do, or even thinking has not started, I am a personal needs, development, testing, operations are done, the result is not technically so invested)
How to add new features
Look at the following two pictures, what's the difference?
The second picture is more than the first image of a banner, prompting to download the app.
There are also advantages to using the Web app, you can publish the mobile version, Web version (also can be called through the menu), desktop version, if the non-mobile version of the use, we would like to add a recommended to download the app banner. These are not functions in my original plan, but I can't because of this feature re-issued version, especially iOS is not possible.
Now if it's you, how can you do this without releasing the app?
Don't tell me you can't. If not, return to a section.
Simply put, it is in this page called a JS server-side extension JS file in $ (' document '). Ready (function () {}); dynamically generate this banner and place it underneath. As for how to dynamically generate page content, this is not the focus of this article, do not know how to find online how to dynamically create page content with jquery
If you figure this out yourself, you can also generate a page dynamically, for example, I'm thinking about how to do an activity page, choose from three scenarios, or in this way.
Dodge some of Apple's rigorous audits
In the palm of the broad material sharing function is to make the social sharing components of the UF alliance. I have no experience in development, I do not know so many lanes of iOS, the results submitted to the App Store, was severely rejected. The reason is very simple, when the phone is not installed, QQ, the page will pop up the use of the way, so that the processing of Apple is very angry, to be unfriendly as a result of rejection.
Another reason is that there is a "check for updates" In my app, this apple is not allowed, because only use their app update reminders, in the app do not allow this feature.
But, I am not the obedient person, the apple does not let me do so, I must obediently obedient?
I still use the method mentioned in the first section, during the submission of Apple audits, I added the code to hide the share and check the Update button in the server-side code so that the Apple would not be visible. The eye does not have the heart to be bored, cannot see him naturally also will not reject me, so I was received by the Apple.
You can also think of the next thing. That's when I deleted the code and the features on iOS appeared in front of the user.
Incremental update to do a good job in fact, the work is done to be more agile, but really did not have time to get this piece. But what we're saying today is enough to make everyone more agile than ever. The last thing to say is that if you want to be really agile, technology is second, learn about agile individuals, learn the values and thinking behind it, and you'll benefit for life.
Likes more than 20 start next
PhoneGap app Development 348192525
Cordova WebApp Development: (7) How to do it in a simple way, without republishing the app to fix bugs, add features, or avoid some of Apple's rigorous audits?