WebKitErrorDomain error 101

大兔子大兔子 提交于 2019-12-01 15:28:53

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.

Do not add whitespace in your string url.

Rakul

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]];
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!