如何编码URL字符串,使其编码&和空间

时间:2016-04-29 06:18:59

标签: ios objective-c urlencode nsurl

我有facebook个人资料图片链接但是当我存储到服务器时,网址正在被剪切但是这里我只是在存储了m获得半链接之后才获得整个链接。

NSString *strURL=[NSString stringWithFormat:@"http://muslim-plus.com/boaster/?aid=%@& fid=%@&fbname=%@&city=%@&country=%@& fbpic=%@",aid,fid,fbName,city,country,fbPhoto];

       NSString* webStringURL = [strURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];


    NSURL *requestURL = [NSURL URLWithString:webStringURL];
    NSLog(@"FB REgister URL=%@",strURL);



    // set URL
    [request setURL:requestURL];

我的网址: https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xfa1/v/t1.0-1/s100x100/10354686_10150004552801856_220367501106153455_n.jpg?oh=1a43217d27f4692752bbbdf044c9b9b7&oe=57B2CB73&gda=1469738559_2a6e31ca3d97d01be6fe6ec25a75a1af

存储到服务器后

https://fbcdn-profile-a.akamaihd.net/hprofile-ak-xfa1/v/t1.0-1/s100x100/10354686_10150004552801856_220367501106153455_n.jpg?oh=1a43217d27f4692752bbbdf044c9b9b7

这是削减= & oe = 57B2CB73& gda = 1469738559_2a6e31ca3d97d01be6fe6ec25a75a1af

0 个答案:

没有答案