There is a project need to use SHARESDK to achieve sharing, click to share content, you need to jump to the specified URL, without parameters of the URL is very good to jump, also no problem, but with parameters or the server returned after the Chinese string:
such as http://localhost:8080/testshare?¶m={"userid": "152632"}, which is the content of the sent
If you set the following normal URL:
NSString * str_share_url=@ "This inside is the content of the sent";
[Umsocialdata Defaultdata].extconfig.qzonedata.url =str_share_url;
It's bound to go wrong.
After a closer look, the union will "?" As a URL in front of the number, ". "After the number will not be read, speaking of which, you know the problem." This is because the passing string, with parameters, is required to encode (to prevent Chinese, so to encode).
The right approach:
NSString * str_share_url=@ "This inside is the content of the sent";
Encode special characters and Chinese in a URL string
NSString *new_url=[strurl Stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]
Set up the QQ space link
[Umsocialdata Defaultdata].extconfig.qzonedata.url =new_url;
Hope to help those in need. This place has wasted me nearly 4 hours.
Note: A problem that must be noted: development involves URLs and network requests the total error can not find the reason, may wish to change the point of view, try to change the encoding method, there may be no image of the harvest.