Follow up: did not use umeng, try to choose wechat native sharing, easy to use!

At the beginning of 2021, the hands-on integration of Umeng Sharing started to record a pit of the place.

According to the steps of the official website integration, and referred to a pile of online articles. Integration is fine.

But when testing sharing, I found that there was no response when CLICKING on sharing, and I did not go back. After checking several times, I was sure that there was no problem with the configuration. However, when deleting the wechat APP and sharing it again, it will prompt that the APP is not installed and the callback method has gone.

UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject]; UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:@" descr:@" thumImage:[UIImage imageNamed:@"search"]]; / / Settings page address shareObject webpageUrl = @ "http://mobile.umeng.com/social"; / / share the message object set share content object messageObject shareObject = shareObject; / / call sharing interface [[UMSocialManager defaultManager] shareToPlatform: platformType messageObject: messageObject currentViewController:self completion:^(id data, NSError *error) { if (error) { UMSocialLogInfo(@"************Share fail with error %@*********",error); }else{ if ([data IsKindOfClass :[UMSocialShareResponse class]]) {UMSocialShareResponse *resp = data; // Share the result message UMSocialLogInfo(@"response Message is %@",resp.message); // UMSocialLogInfo(@"response originalResponse data is %@",resp.originalResponse); }else{ UMSocialLogInfo(@"response data is %@",data); } } [self alertWithError:error]; }];Copy the code

I didn’t make a judgment because I was not familiar with the procedure. That is, when —- is connected with wechat, there is a problem.

But I spent a lot of time on the website and read a lot of blogs. The configuration is in accordance with the above mentioned, no problem. Why not? I thought it was the real thing. Or there is a problem with the Universal link configured in the background. It is no problem to check it carefully.

This time has been a day!

After work, I am angry, certainly do not want to go off work, a copy, with wechat native try, easy to share! . Well, Friends! Shit!!

Wechat sharing success, also roughly understand that wechat needs information, Universal Link and APPkey

I took a look at the interface initialized by Friendly Alliance

[[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_WechatSession appKey:@"wxxxxx3" appSecret:@"064f89xxxxxx518687a" redirectURL:nil];
Copy the code

What? The Qing Dynasty died?? It’s 2021, what are you doing, an appSecret and appKey!! You didn’t know wechat needed Universal Link.

Oh, no, there’s a URL behind it. Click on it. Oh, you can’t see anything. Oh, oh, I think I was wrong about you.

I added a Universal link to the URL. Pop pop… To start!

Mom sell batch! Oh, good for you, Buddy! Not giving me a chance to forgive you!

So I started searching, Universal Link, and finally

Found it.

Universal link needs to be set up. I suggest updating the official document. Also almost used the hot chicken U-link, I he yao have Universal link, I use your U link meaning ????

The articles about the friendship alliance on the net are very old, maybe everyone does not use it, maybe.

[UMSocialGlobal shareInstance].universalLinkDic = @{@(UMSocialPlatformType_WechatSession):@"https://youmensb.com/"};
Copy the code

3 configuration methods, 3 different objects, may be I too dishes, must be!

[UMConfigure initWithAppkey:@"5ff7d220sssss2" channel:@"App Store"];
    [UMSocialGlobal shareInstance].universalLinkDic = @{@(UMSocialPlatformType_WechatSession):@"https://baidu.com/"};
    [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_WechatSession appKey:@"wxef5cfcsdfs8sdfsdfs7a113" appSecret:@"sdfs4f8sfsdfsdf9772a5a68fc518687a" redirectURL:nil];
Copy the code

Problem solved!

At least why should I use friends, Andrew’s classmates, after work, the woods will be there!

Hello Youmeng, goodbye Youmeng!