1、
在 SDK 路径
UMSocalSDK -- UMSocialCore.framework -- Headers -- UMSocialPlatformConfig.h
文件中定义你需要的平台类型
//用户自定义的平台
UMSocialPlatformType_UserDefine_Begin = 1000,
UMSocialPlatformType_GZB = 1001,//GZB
UMSocialPlatformType_UserDefine_End = 2000,
2、创建QXCustomSharePlatform类
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) {
...
}];