[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