步骤一:配置LSApplicationQueriesSchems



友盟分享步骤&



2.配置url types

3.appdelegate.m中进行操作


 /* 打开调试日志 */

 [[UMSocialManager defaultManager] openLog:YES];

 

 /* 设置友盟appkey */

 [[UMSocialManager defaultManager] setUmSocialAppkey:@""];

 [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_QQ appKey:@""/*设置QQ平台的appID*/  appSecret:nil redirectURL:@"http://zy.b6ss.com/public/api/Home/APP"];

 [self configUSharePlatforms];

    return YES;

}

-(void)configUSharePlatforms{

 

 /* 设置微信的appKey和appSecret */

 [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_WechatSession appKey:@"" appSecret:@"" redirectURL:@""];

 

  [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_QQ appKey:@""/*设置QQ平台的appID*/  appSecret:nil redirectURL:nil];


步骤4.(appdelegate中)


// 支持所有iOS系统

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation

{

 

 BOOL result = [[UMSocialManager defaultManager] handleOpenURL:url sourceApplication:sourceApplication annotation:annotation];

 return result;

}


步骤五:

在需要弹出的界面设置代码:


-(void)clickbtn{

 NSLog(@"点击的是红色按钮");

 [UMSocialUIManager setPreDefinePlatforms:@[@(UMSocialPlatformType_WechatSession),@(UMSocialPlatformType_WechatTimeLine),@(UMSocialPlatformType_QQ),@(UMSocialPlatformType_Qzone)]];

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

  // 根据获取的platformType确定所选平台进行下一步操作

  //创建分享消息对象

  UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];

  //创建网页内容对象

  NSString* thumbURL =  @"http://zy.b6ss.com/public/api/Home/APP";

  UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:@"这个周末玩点不一样的!" descr:@"来桌悦,玩桌游,交朋友。享受面对面的精彩!" thumImage:thumbURL];

  //设置网页地址

  shareObject.webpageUrl = @"http://zy.b6ss.com/public/api/Home/APP";

  //分享消息对象设置分享内容对象

  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);

    }

   }

   

  }];

 }];

 

}



(注:qq的secrete可以不必填写)





相关文章:

  • 2021-11-23
  • 2022-01-15
  • 2021-12-08
  • 2021-07-12
  • 2021-11-23
  • 2022-02-11
  • 2022-12-23
猜你喜欢
  • 2021-06-14
  • 2022-12-23
  • 2021-08-20
  • 2021-09-26
  • 2022-01-19
相关资源
相似解决方案