• %3f URL --> '?'拼接引发的问题


     
     

     

    [–]lyinstevemod 2 points 1 year ago 

    If you're using Alamofire, you should really be submitting URL encoded parameters as a dictionary instead, because Alamofire handles serialization. You're doing more work than you should.

     

    [–]xStory_Timex[S1 point 1 year ago 

    I don't understand, can you explain more

     

    [–]lyinstevemod 1 point 1 year ago 

    So right now you're adding URL parameters, right? And you're serializing them into a string yourself.

    You also said you're using Alamofire. Alamofire will actually take those arguments in a Dictionary as a parameter to the request() function. You don't need to -- and shouldn't -- manually create those strings.

    Specifically just

    ?brand_id=(id)
    

    Instead, pass the parameters into the Alamofire request() function.

    Alamofire.request(
       .GET,
       "/products",
       parameters: ["brand_id": id]
    )
    
     
     
     
     
     
     
     
  • 相关阅读:
    Linux关闭防火墙和selinux
    Linux内存VSS,RSS,PSS,USS解析
    JS 将有父子关系的数组转换成树形结构数据
    npm install报错类似于npm WARN tar ENOENT: no such file or directory, open '*** ode_modules.staging***
    react-native之文件上传下载
    Markdown语法简记
    MySQL运维开发
    股票投资
    数据仓库原理与实战
    python基础
  • 原文地址:https://www.cnblogs.com/Jenaral/p/5638645.html
Copyright © 2020-2023  润新知