SLComposeViewController *composeVc = [SLComposeViewController composeViewControllerForServiceType:self.shareOpenString];
//添加分享标题
// [composeVc setInitialText:news.title];
//添加分享的图片
// [composeVc addImage:image];
//添加分享的URL
[composeVc addURL:url];
// 弹出控制器进行分享
[self presentViewController:composeVc animated:YES completion:nil];
Problems you want to solve: 1. Sometimes you cannot get pictures and titles when sharing to WeChat or WeChat Moments; 2. What is the internal implementation mechanism of SLComposeViewController?
Problem description: Due to project requirements, UIActivityViewController cannot be used, but SLComposeViewController is used directly to pop up. There is such a phenomenon that if you share it on QQ, a chrysanthemum will appear in the "untitled" area as shown in the picture. When the title and picture are requested to be displayed, the chrysanthemum will disappear naturally. Sharing to WeChat does not have this chrysanthemum, and whether you can preview the picture and title based on the URL request depends on your mood. I have been struggling with this for a long time. The SLComposeViewController class does not explain that there are some description controls inside, and it is really impossible to study it.
Some people may ask why not directly set the shared image and title, as follows: If I share to WeChat, the set image and title are displayed normally. If I share to QQ, the set image and title will be reset (the system will request it based on the shared URL). So I simply didn’t add the image and title, and let the system directly request back the shared URL for automatic settings.
If there are experts who are interested or have studied this topic, please give me some advice!
滿天的星座2017-05-02 09:39:49
Hello, can I ask a question? Share to WeChat What is this type? Now I have the same needs as you. I have been looking for this type for a long time but I still can't find it.