Recently, the company has been required to learn PHONEGAP packaging project I was the first time to start contact with a few of the feeling is good? Mostly Html5+js code
During this time I met a lot of problems
Question 1, the boss gave me a www bag called me to run a look at the effect of the iphone mobile phone boss may also not understand iOS (Boss is engaged in Android) said with WebView loaded so I wrote the code
Load 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]; BaseURL know the URL of the bundle, you can call the bundle of other files, pictures of music what [Self.view Addsubview:webview];
That's what the interface seems to be showing, but it's got a lot of problems and I'm going to find a way
On the internet to find a variety of information found that the original use phonegap run WWW package when Xcode is not to write a code in which
The config file is a global profile that writes the interface to be displayed in <content src="login/login.html" /> This is the landing screen.
<?xml version= "1.0" encoding= "UTF-8"?><!--Licensed to the Apache software Foundation (ASF) under one or more con Tributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); You are not a use of this file except in compliance with the License. Obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 unless required by applicable law or AG Reed to in writing, software distributed under the License are distributed on a "as is" BASIS, without warranties OR Condi tions of any KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.--><widget xmlns = "Http://www.w3.org/ns/widgets" id = "Io.cordova.helloCordova" Version = "2.0.0" > <nam E>hello cordova</name> <DESCRIPTION> A Sample Apache Cordova application that responds to the Deviceready event. </description> <author href= "Http://cordova.io" email= "[email protected]" > Apache Cordova Team </author> <access origin= "*"/> <!--<content src= "http://mysite.com/myapp.html"/> for Exter NAL pages--<content src= "login/login.html"/> <!--Preferences for IOS---<preference name= "Allowinlinemediaplayback" value= "false"/> <preference name= "Autohidesplashscreen" value= "true"/> <pre Ference name= "Backupwebstorage" value= "cloud"/>
So some of the runtime will appear three frames (because the WWW package is the boss sent me, he is engaged in Android) One click Cancel can also get the desired effect of the task can also be completed but click three times Cancel button who would not feel bored
Picture of attached piece 1:
Picture 2:
Picture 3:
For this problem, the boss can not say that I am also baffled the solution later found a clue on the stack overflow I tried for a while and finally succeeded.
Stack overflow It says something about what's on the Android. I took a closer look at the engineering Discovery Project there are two such documents
So I moved one of the files out of the package to the desktop and ran the program again and found that there was no problem.
Run as follows
1.
2.
3.
PhoneGap running the WWW package encountered problems