iOS-友盟SDK6.4,自定义分享

1、

在 SDK 路径
UMSocalSDK -- UMSocialCore.framework -- Headers -- UMSocialPlatformConfig.h 

文件中定义你需要的平台类型

//用户自定义的平台 UMSocialPlatformType_UserDefine_Begin = 1000, UMSocialPlatformType_GZB              = 1001,//GZB UMSocialPlatformType_UserDefine_End = 2000,

2、创建QXCustomSharePlatform类

// QXCustomSharePlatform.h
#import <UMSocialCore/UMSocialCore.h>
@interface QXCustomSharePlatform : UMSocialHandler <UMSocialPlatformProvider>

@end

3、

在QXCustomSharePlatform.m中,实现友盟文档要求一定要实现的方法:

+(void)load{

[superload];

}

+(NSArray*) socialPlatformTypes

{

return @[@(UMSocialPlatformType_UserDefine_Begin+1)];

}

+ (UMSocialTemplateHandler *)defaultManager

{

static UMSocialTemplateHandler *instance = nil;

staticdispatch_once_t onceToken;

dispatch_once(&onceToken, ^{

if (!instance) {

instance = [[self alloc] init];

}

});

return instance;

}

// 点击自定义平台的图标之后,会走这个方法,我这里是发送通知,告诉实现功能的页面要分享什么

- (void)umSocial_ShareWithObject:(UMSocialMessageObject *)object withCompletionHandler:(UMSocialRequestCompletionHandler)completionHandler
{
    NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
    [notificationCenter postNotificationName:@"ShareToLocalNotification" object:nil userInfo:nil];
}


4、

在友盟分享中添加自己自定义的平台

 [UMSocialUIManager addCustomPlatformWithoutFilted:UMSocialPlatformType_GZB withPlatformIcon:@“自己平台的图片” withPlatformName:@“自己平台的名字”];

[UMSocialUIManager showShareMenuViewInWindowWithPlatformSelectionBlock:^(UMSocialPlatformType platformType, NSDictionary *userInfo) {

...

}];





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值