Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问可以直接打开微信分享,跳过选择分享菜单界面么? #3

Open
banli17 opened this issue Jul 10, 2017 · 1 comment

Comments

@banli17
Copy link

banli17 commented Jul 10, 2017

找到个文章,http://www.jianshu.com/p/ce123a2015f9 看了下代码,但是不知道应该怎么修改

NSString *test = @"com.tencent.xin.sharetimeline";
UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:objectsToShare applicationActivities:nil];

这2个怎么处理一下呢

@banli17
Copy link
Author

banli17 commented Jul 10, 2017

搞了半天,搞出来了,虽然看不懂代码。

  NSString *test = @"com.tencent.xin.sharetimeline";
  NSUInteger count = [ImagesUrl count];
  //定义一个可变数组来存放分享的图片,最多不能超过9个
  NSMutableArray * objectsToShare = [NSMutableArray arrayWithCapacity:9];
  
  SLComposeViewController *activityVC = [SLComposeViewController composeViewControllerForServiceType:test];
  for (int i = 0; i < count; i++) {
    NSString * imageUrl = [ImagesUrl objectAtIndex: i];
    UIImage * imageToShare = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString: imageUrl]]];
    [objectsToShare addObject:imageToShare];
    [activityVC addImage:imageToShare];
    if(i == 8)break;
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant