Problems with running www package in phonegap

Source: Internet
Author: User

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,

 

 

 

Related Article

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.