Problems with running www package in phonegap
Recently, the company has been asking to learn about the phonegap packaging project. I also started to use it for the first time. I feel pretty good. It's mainly HTML5 + JS Code.
During this period, I encountered many problems.
Problem 1: The boss gave me a www package and told me to run it on an iPhone. You can see that the boss may not know much about iOS (the boss is engaged in Android) I used webView to load, so I wrote such code.
// Load the local HTML webView = [[UIWebView alloc] initWithFrame: CGRectMake (0, 0, self. view. bounds. size. width, self. view. bounds. size. height)]; NSString * htmlFile = [[NSBundle mainBundle] pathForResource: @ "login" ofType: @ "html"]; NSString * htmlString = [NSString stringWithContentsOfFile: htmlFile encoding: NSUTF8StringEncoding error: nil]; NSString * path = [[NSBundle mainBundle] bundlePath]; NSURL * baseURL = [NSURL fileURLWithPath: path]; [webView loadHTMLString: htmlString baseURL: baseURL]; // know the Url of the bundle to call other files in the bundle. [self. view addSubview: webView];
After doing this, the interface seems to be displayed, but I encountered many problems, so I found another way.
I found a variety of materials on the Internet and found that Xcode didn't need to write a code when I used phonegap to run the www package.
Config. xml is a global configuration file that writes the interface to be displayed in Here is the login interface.
Hello Cordova
A sample Apache Cordova application that responds to the deviceready event.
Apache Cordova Team
In this way, three bullet boxes will appear during some running tasks (because the www package is sent to me by the boss and he is engaged in Android) you can also click Cancel at one time to get the desired effect. However, who will not bother to click Cancel three times?
Attachment image 1:
Image 2:
Image 3:
I couldn't tell this problem either. I was puzzled. Later, I found a clue on Stack Overflow. I tried it for a long time and finally succeeded.
Stack Overflow I mentioned that I brought Android into the system and said it was vague. I carefully checked the project and found that there were two such files in the project.
So I removed a file from the package to the desktop and ran the program again. I found that there was no problem.
Run the following command:
1,
2,
3,