友盟分享出现的问题——单独分享可以,面板不出来

2017-07-27  本文已影响42人  元昊
[UMSocialUIManager showShareMenuViewInWindowWithPlatformSelectionBlock:^(UMSocialPlatformType platformType, NSDictionary *userInfo) {
            
                UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
                //创建网页内容对象
                NSString* thumbURL =  @"https://ss1.baidu.com/6ONXsjip0QIZ8tyhnq/it/u=2155408891,2746605558&fm=173&s=7F125A812CC0A51BD99D3D8803003090&w=550&h=308&img.JPEG";
                
                UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:@"测试数据😊 " thumImage:thumbURL];
                //设置网页地址
                shareObject.webpageUrl = @"http://www.baidu.com";
                
                //分享消息对象设置分享内容对象
                messageObject.shareObject = shareObject;
                
                //调用分享接口
                [[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;
                            //分享结果消息
                            UMSocialLogInfo(@"response message is %@",resp.message);
                            //第三方原始返回的数据
                            UMSocialLogInfo(@"response originalResponse data is %@",resp.originalResponse);
                            
                        }else{
                            UMSocialLogInfo(@"response data is %@",data);
                        }
                    }
                }];
            }];

在新版本 v6.4.5(2017-7-11)之前还没有出现,就没在意,然而给web页的分享加新功能时就是不能调用面板,查看了白名单没问题,单独分享也可以。
之后在UMSocialUIManager里面找到了setShareMenuViewDelegate,有三个代理方法可以使用

1、分享面板显示的回调

- (void)UMSocialShareMenuViewDidAppear;

2、 分享面板的消失的回调

- (void)UMSocialShareMenuViewDidDisappear;

3、返回分享面板的父窗口,用于嵌入在父窗口上显示
@param defaultSuperView 默认加载的父窗口
@return 返回实际的父窗口
@note 返回的view应该是全屏的view,方便分享面板来布局。 @note 如果用户要替换成自己的ParentView,需要保证该view能覆盖到navigationbar和statusbar
@note 当前分享面板已经是在window上,如果需要切换就重写此协议,如果不需要改变父窗口则不需要重写此协议

- (UIView*)UMSocialParentView:(UIView*)defaultSuperView;

之前的两个看起来可以做一些相应事件的回调,第三个就确保分享面板可以加载到指定的父视图

- (UIView*)UMSocialParentView:(UIView*)defaultSuperView{
    
    return self.view;
}

不过在API里面也暂时找不到是不是这个原因,新的SDK也没有说明

上一篇 下一篇

猜你喜欢

热点阅读