我有一个UIWebView,我希望在加载链接后可见.它是隐藏的,一切都有效,直到它需要显示.我很肯定我可以再次看到UIWebView,因为我在调用URL后放置了它.我很肯定webViewDidFinishLoading在UIWebView确实完成加载时没有调用该方法,也不会记录该方法中的内容.什么可能导致这个问题?谢谢.这是我的代码:
在.M文件:
@interface KnoxGradesViewController : UIViewController <UIWebViewDelegate> {
IBOutlet UIWebView *webView;
IBOutlet UIButton *log;
IBOutlet UISwitch *rem;
IBOutlet UIActivityIndicatorView *stat;
}
@property (nonatomic, retain) IBOutlet UIButton *about;
@property (nonatomic, retain) IBOutlet UITextField *username;
@property (nonatomic, retain) IBOutlet UITextField *password;
@property (nonatomic, retain) IBOutlet UIButton *login;
@property (nonatomic, retain) IBOutlet UILabel *warning;
@property (nonatomic, retain) IBOutlet UIWebView *webView;
@property (nonatomic, retain) IBOutlet UIButton *log;
-(IBAction)showAbout;
-(IBAction)checkFields;
-(IBAction)logOut;
Run Code Online (Sandbox Code Playgroud)
该.H文件:
- (void)webViewDidFinishLoad:(UIWebView *)mwebView {
NSLog(@"Got here!");
[mwebView …Run Code Online (Sandbox Code Playgroud) 我需要遵循HTTPost给我的重定向.当我创建一个HTTPost,并尝试读取响应时,我得到重定向的页面html.我怎样才能解决这个问题?码:
public void parseDoc() {
final HttpParams params = new BasicHttpParams();
HttpClientParams.setRedirecting(params, true);
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(
"https://secure.groupfusion.net/processlogin.php");
String HTML = "";
try {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(3);
nameValuePairs.add(new BasicNameValuePair("referral_page",
"/modules/gradebook/ui/gradebook.phtml?type=student_view"));
nameValuePairs.add(new BasicNameValuePair("currDomain",
"beardenhs.knoxschools.org"));
nameValuePairs.add(new BasicNameValuePair("username", username
.getText().toString()));
nameValuePairs.add(new BasicNameValuePair("password", password
.getText().toString()));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
String g = httppost.getURI().toString();
HttpResponse response = httpclient.execute(httppost);
HTML = EntityUtils.toString(response.getEntity());
ResponseHandler<String> responseHandler = new BasicResponseHandler();
String ResponseBody = httpclient.execute(httppost, responseHandler);
sting.setText(HTML);
} catch (ClientProtocolException e) {
} catch …Run Code Online (Sandbox Code Playgroud) 我正在检索从HttpGet获取的页面的整个html和javascript.我可以成功获得Html和Javascript.当我尝试将其加载到Web视图中时,Web视图为我提供了"页面不可用",并显示了以非常奇怪的格式加载的html和javascript,其中元素之间有百分比.我很肯定html和javascript正在下载并以Html页面的形式.我也在网络视图中启用了javascript.什么可能导致这样的问题?码:
public void parseDoc() {
new Thread(new Runnable() {
@Override
public void run() {
String summary = "<html><body>You scored <b>192</b> points.</body></html>";
sting.loadData(summary, "text/html", null);
HttpParams params = new BasicHttpParams();
HttpClientParams.setRedirecting(params, true);
httpclient = new DefaultHttpClient();
httppost = new HttpPost(
"https://secure.groupfusion.net/processlogin.php");
String HTML = "";
try {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(
3);
nameValuePairs
.add(new BasicNameValuePair(
"referral_page",
"/modules/gradebook/ui/gradebook.phtml?type=student_view&jli=t&jli=t&jli=t&jli=t&jli=t&jli=t&printable=FALSE&portrait_or_landscape=portrait"));
nameValuePairs.add(new BasicNameValuePair("currDomain",
"beardenhs.knoxschools.org"));
nameValuePairs
.add(new BasicNameValuePair("username", user));
nameValuePairs
.add(new BasicNameValuePair("password", pass));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
HTML = EntityUtils.toString(response.getEntity());
Document doc = …Run Code Online (Sandbox Code Playgroud) android ×2
java ×2
http-get ×1
http-post ×1
iphone ×1
javascript ×1
objective-c ×1
uiwebview ×1
webview ×1