0

こんにちは、単純な htmlNSStringがあります。ブラウザでは問題なく動作しますが、iPhone ではロードされません。私は単純なものを使用しています: [self.w loadHTMLString:errorString baseURL:nil]. 私は何が欠けていますか?

NSString* errorString = [NSString stringWithFormat:
        @"<html><body> <iframe src=\"http://64.183.101.142:81/pda.htm\"width=\"500\" height=\"500\"></iframe></body></html>"];
4

2 に答える 2

0

最初にリクエストまたは HTML を webview にロードし、次のプロトコルで UIWebViewDelegate メソッドを使用してこのリクエストをキャプチャする必要があります

 - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
    {

      //capture request =>  request
       //From here you have the NSURLRequest object
  //You can extract the headers of the request to NSDictionary which will contain   //the         
//authentication cookie details, token, etc. using the following method of NSURLRequest
        //- (NSDictionary *)allHTTPHeaderFields

    }

ソースソースリンク

于 2013-08-29T15:53:18.787 に答える
0

認証が必要な場合は、リクエストのタイプに応じて文字列を変更する必要があります。

get の場合は、"?" が付きます。http: //xx.xx.xx.xx :81/pda.htm?user= "userX"&passwd="something" ポストメソッドの場合は、本体内でデータを渡します。あなたの要求の。[NSURLRequest setHTTPBody:];

これが役立つことを願っています。

于 2013-08-29T15:57:20.413 に答える