SHARESDK share-qqapi-qqapi.m:252 param Error:url is nil

Source: Internet
Author: User

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?&param={"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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.