https://****.xhtml#sigil_toc_id_
携带#号参数,请求发出去后,自动忽略掉了#号和后面的字符。
解决方案:
NSString *urlString = @"https://****.xhtml#sigil_toc_id_";
urlString = [urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
PS:在上述代码中,```stringByAddingPercentEncodingWithAllowedCharacters:```方法用于将URL中的特殊字符转换为适合网络传输的格式。这确保了#号被正确编码为%23。