WebKitErrorDomain error 101

后端 未结 3 592
孤独总比滥情好
孤独总比滥情好 2021-01-17 11:35

The following code produces and error of:

WebKitErrorDomain error 101 

code:

-(Void) searchBarSearchButtonClicked: (UISear         


        
相关标签:
3条回答
  • 2021-01-17 12:06

    Do not add whitespace in your string url.

    0 讨论(0)
  • 2021-01-17 12:27

    Make Sure that your url doesn't contain white space and new line characters.

    To do this you can use the following code:

    NSString *newString = [url stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
    
    0 讨论(0)
  • 2021-01-17 12:32

    According to the WebKitError header, error 101 means, "WebKitErrorCannotShowURL" which is not very helpful.

    This line is incorrect:

    NSURL * url = [NSURL URLWithString: [NSString stringWithFormat: @ "http://http://www.google.com/search?q =%, query]]; 
    

    ... it should look like:

    NSURL * url = [NSURL URLWithString: [NSString stringWithFormat: @ "http://www.google.com/search?q =%@", query]]; 
    

    I'm not sure if that it causing the error by producing a bad URL or if it is a typo.

    0 讨论(0)
提交回复
热议问题