zoukankan      html  css  js  c++  java
  • iphone:URL initWithString 返回为空

    Parameters

     

    URLString

    The string with which to initialize the NSURL object. This string must conform to URL format as described in RFC 2396. This method parses URLString according to RFCs 1738 and 1808.

     

     Discussion

    This method expects URLString to contain any necessary percent escape codes, which are ‘:’, ‘/’, ‘%’, ‘#’, ‘;’, and ‘@’. Note that ‘%’ escapes are translated via UTF-8.

    所以URLString中有空格的要变成:%20

    [urlstring stringByReplacingOccurrencesOfString:@" "withString:@"%20"]]

    然后还要进行编码转换

    str=[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

     

     

     

  • 相关阅读:
    MySQL DATE_SUB和SUBDATE函数:日期减法运算
    stream将list转化为map
    HackLab-脚本1
    隐写术-2
    Bug-变量
    Bug-you must stop it
    Bug-域名解析
    Bug-web3
    Bug-矛盾
    Bug-web基础$_POST 30
  • 原文地址:https://www.cnblogs.com/mybkn/p/2519406.html
Copyright © 2011-2022 走看看