加载中 ...
首页 > 常见问题 正文

sharesdk一句代码即可分享,快速实现社会化分享组件

2019-03-24 10:28:26 来源:沈阳软件公司 作者:沈阳软件开发

 

….

 

 

如需要增添子节点继续父节点,可以新增一属性parent。例如:

 

1

2

3

4

5

 

….

 

现实分享时,子节点会继续父节点内容,子节点不具有的参数,而父节点具有,则会被增补到子节点上。

919A00BB-A436-4F31-A3BD-EBC3E46D15ED

ShareContent.xml示例:

2.准备好ShareContent.xml文件之后,就可以挪用上述新增接口举行分享了!

 

 

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

#import

[ShareSDK shareWithContentName:@"mob" /*对应的节点的name 属性*/

 

platform:self.platformType /*目的分享平台类型*/

 

customFields:specialFied /*自界说替换字符的字典,也可以传空*/

 

onStateChanged:^(SSDKResponseState state, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error)

{

switch (state)

{

//凭据分享效果的状态码处置惩罚您的营业代码

//…

}

 

}];

 

3.使用xml文件设置信息,在3.4.2版本中我们添加了挪用我们UI的分享接口

(1)使用我们的分享菜单以及编辑界面的接口:

 

 

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

#import

NSString *imgPath = [[NSBundle mainBundle] pathForResource:@"Sample" ofType:@"jpg"];

    NSDictionary *customContent = @{@"text":@"Lisa",

                                    @"title":@"题目",

                                    @"imgUrl":imgPath};

    [ShareSDK showShareActionSheet:view items:nil contentName:@"ShareSDK" customFields:customContent onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) {

        switch (state) {

            case SSDKResponseStateSuccess:

            {

                UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"分享乐成"

                                                                    message:nil

                                                                   delegate:nil

                                                          cancelButtonTitle:@"确定"

                                                          otherButtonTitles:nil];

                [alertView show];

                break;

            }

            case SSDKResponseStateFail:

            {

                UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"分享失败"

                                                                    message:[NSString stringWithFormat:@"%@", error]

                                                                   delegate:nil

                                                          cancelButtonTitle:@"确定"

                                                          otherButtonTitles:nil];

                [alertView show];

                break;

            }

                default:

                break;

        }

 

    }];

 

“沈阳软件公司”的新闻页面文章、图片、音频、视频等稿件均为自媒体人、第三方机构发布或转载。如稿件涉及版权等问题,请与

我们联系删除或处理,客服QQ:55506560,稿件内容仅为传递更多信息之目的,不代表本网观点,亦不代表本网站赞同

其观点或证实其内容的真实性。