[ios]基于Social.framework 的ios6微博分享

今天扫论坛问题时看到说ios6有一个通过Social.framework的sns分享效果

就查了些资料 做了个DEMO

感觉比android通过intent实现分享还简单=-=

多一种实现分享微博的方法。

说下优缺点:

优点:

简单,快速,苹果支持什么他就支持什么[而且我们认为苹果未来绝对会支持更多的SNS]

缺点:

io6+,大陆方面目前只支持新浪微博,神马腾讯,网易,xx都没有。界面不可定制。

 

总结:感觉在显示使用中 如果不担心友盟监听你的数据的话 友盟的那套支持新浪 腾讯 人人的包会更好点。

不过未来苹果会怎么做呢?没人知道

 

 

这位写的更详细:http://www.cnblogs.com/russelljing/archive/2012/10/09/2717233.html

还写了单独支持分享某一特定SNS [如新浪微博]

 

//
//  ViewController.m
//  LrnShareSNSDemo
//
//  Created by liu poolo on 12-10-22.
//  Copyright (c) 2012年 liu poolo. All rights reserved.
//

#import "ViewController.h"
#import <Social/Social.h>

@interface ViewController ()
@property UIImage *shareImage;
@property NSString *shareText;
@end

@implementation ViewController
@synthesize shareImage=_shareImage;
- (void)viewDidLoad
{
    [super viewDidLoad];
    self.shareImage=[UIImage imageNamed:@"share_image.png"];
    self.shareText=@"现在较为蛋疼的是 用ios6自带的social.framework 发出来的 在微博来源会显示是ios而不是iphoneX 而且如果默认输入字数如果超过了限制  他会不显示  略坑爹的说";
	// Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)buttonPressed:(id)sender {
    NSLog(@"111");
    NSArray *activityItems;
    if(self.shareImage){
        activityItems=@[self.shareText,self.shareImage];
    }else{
        activityItems=@[self.shareText];
    }
    UIActivityViewController* aVC=[[UIActivityViewController alloc]initWithActivityItems:activityItems applicationActivities:nil];
    [self presentViewController:aVC animated:YES completion:nil];
}


@end
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值