iOS Umeng分享/第三方授权登录

//错误代码提示:

typedef NS_ENUM(NSInteger, UMSocialPlatformErrorType) {
+    UMSocialPlatformErrorType_Unknow            = 2000,            // 未知错误
+    UMSocialPlatformErrorType_NotSupport        = 2001,            // 不支持(url scheme 没配置,或者没有配置-ObjC, 或则SDK版本不支持或则客户端版本不支持)
+    UMSocialPlatformErrorType_AuthorizeFailed   = 2002,            // 授权失败
+    UMSocialPlatformErrorType_ShareFailed       = 2003,            // 分享失败
+    UMSocialPlatformErrorType_RequestForUserProfileFailed = 2004,  // 请求用户信息失败
+    UMSocialPlatformErrorType_ShareDataNil      = 2005,             // 分享内容为空
+    UMSocialPlatformErrorType_ShareDataTypeIllegal = 2006,          // 分享内容不支持
+    UMSocialPlatformErrorType_CheckUrlSchemaFail = 2007,            // schemaurl fail
+    UMSocialPlatformErrorType_NotInstall        = 2008,             // 应用未安装
+    UMSocialPlatformErrorType_Cancel            = 2009,             // 取消操作
+    UMSocialPlatformErrorType_NotNetWork        = 2010,             // 网络异常
+    UMSocialPlatformErrorType_SourceError       = 2011,             // 第三方错误
+    
+    UMSocialPlatformErrorType_ProtocolNotOverride = 2013,   // 对应的	UMSocialPlatformProvider的方法没有实现


//支持分享的类型:

分享目前支持的类型有:

  • 网页类型(网页链接)

  • 图片

  • 文本

  • 表情(GIF图片,即Emotion类型,只有微信支持)

  • 图文(包含一张图片和一段文本)

  • 视频(只支持视频URL、缩略图及描述)

  • 音乐(只支持音乐URL、缩略图及描述)


//=========

typedef NS_ENUM(NSInteger,UMSocialPlatformType)

{

    UMSocialPlatformType_UnKnown            = -2,

    //预定义的平台

    UMSocialPlatformType_Predefine_Begin    = -1,

    UMSocialPlatformType_Sina               = 0,//新浪

    UMSocialPlatformType_WechatSession      = 1,//微信聊天

    UMSocialPlatformType_WechatTimeLine     = 2,//微信朋友圈

    UMSocialPlatformType_WechatFavorite     = 3,//微信收藏

    UMSocialPlatformType_QQ                 = 4,//QQ聊天页面

    UMSocialPlatformType_Qzone              = 5,//qq空间

    UMSocialPlatformType_TencentWb          = 6,//腾讯微博

    UMSocialPlatformType_AlipaySession      = 7,//支付宝聊天页面

    UMSocialPlatformType_YixinSession       = 8,//易信聊天页面

    UMSocialPlatformType_YixinTimeLine      = 9,//易信朋友圈

    UMSocialPlatformType_YixinFavorite      = 10,//易信收藏

    UMSocialPlatformType_LaiWangSession     = 11,//点点虫(原来往)聊天页面

    UMSocialPlatformType_LaiWangTimeLine    = 12,//点点虫动态

    UMSocialPlatformType_Sms                = 13,//短信

    UMSocialPlatformType_Email              = 14,//邮件

    UMSocialPlatformType_Renren             = 15,//人人

    UMSocialPlatformType_Facebook           = 16,//Facebook

    UMSocialPlatformType_Twitter            = 17,//Twitter

    UMSocialPlatformType_Douban             = 18,//豆瓣

    UMSocialPlatformType_KakaoTalk          = 19,//KakaoTalk

    UMSocialPlatformType_Pinterest          = 20,//Pinteres

    UMSocialPlatformType_Line               = 21,//Line

    

    UMSocialPlatformType_Linkedin           = 22,//领英

    

    UMSocialPlatformType_Flickr             = 23,//Flickr


    UMSocialPlatformType_Tumblr             = 24,//Tumblr

    UMSocialPlatformType_Instagram          = 25,//Instagram

    UMSocialPlatformType_Whatsapp           = 26,//Whatsapp

    UMSocialPlatformType_DingDing           = 27,//钉钉

    

    UMSocialPlatformType_YouDaoNote         = 28,//有道云笔记

    UMSocialPlatformType_EverNote           = 29,//印象笔记

    UMSocialPlatformType_GooglePlus         = 30,//Google+

    UMSocialPlatformType_Pocket             = 31,//Pocket

    UMSocialPlatformType_DropBox            = 32,//dropbox

    UMSocialPlatformType_VKontakte          = 33,//vkontakte

    UMSocialPlatformType_FaceBookMessenger  = 34,//FaceBookMessenger

    

    UMSocialPlatformType_Predefine_end      = 999,

    

    //用户自定义的平台

    UMSocialPlatformType_UserDefine_Begin = 1000,

    UMSocialPlatformType_UserDefine_End = 2000,

};


// 第三方平台支持的分享类型总览

平台文本图片图文Web链接视频链接音乐链接其他
微信好友×gif表情及文件
微信朋友圈×-
微信收藏×文件
新浪微博-
QQ×-
QQ空间×-
支付宝×-
钉钉×××-
点点虫×-
易信×-
豆瓣×××-
人人×××-
腾讯微博×××-
有道云笔记×××文件
印象笔记文件
有道云笔记-
Linkedin(领英)图片链接必须为网络链接,不支持本地图片
Facebook-
FaceBookMessenger×-
Twitter-
Instagram×××××-
Kakao×××-
Line×××-
Tumblr×××××-
Pinterest×××××图片必须为网络链接
WhatsApp××××-
Flickr×××××-
Google+×-
Pocket××图片为网络链接
VKontakte×-
DropBox×文件
短信-
邮件-

//目前分享面板已经模块,用户可以根据自己的需求来自定义自己需要的面板。 该面板分有四个主体控件组成。

  • UMSocialShareTitleView title控件
  • UMSocialSharePageScrollView 分页控件
  • UMSocialSharePageControl PageControl控件
  • UMSocialShareCancelControl CancelControl控件
//注意:新浪开放平台的授权回调页面要设置------否则会出现redirect _uri_mismature;
//可能出现bitcode的问题

You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE)

--------在build setting下 ENABLE_BITCODE 设置为 false 就可以了

//URL Scheme是通过系统找到并跳转对应app的一类设置,通过向项目中的info.plist文件中加入URL types可使用第三方平台所注册的appkey信息向系统注册你的app,当跳转到第三方应用授权或分享后,可直接跳转回你的app

//第三方登录的原理:从第三方获取的数据去注册自己app的账号;下面是新浪微博授权过程示意图:

关于OAuth2.0协议的授权流程可以参考下面的流程图,其中Client指第三方应用,Resource Owner指用户,Authorization Server是我们的授权服务器,Resource Server是API服务器。




自己的应用程序请求用户是否同意授权----------用户同意授权后----------新浪的授权服务器批准个授权--------授权服务器吧accesstoken发送给自己的应用-----------自己的应用通过access token作为参数再向新浪的资源服务器申请受保护的资源;

//******************************

#import "AppDelegate.h"

#import <UMSocialCore/UMSocialCore.h>

#import <UShareUI/UShareUI.h>


@interface AppDelegate ()


@end

//#define    USHARE_DEMO_APPKEY @"58256783a325115d9a0000c2"

@implementation AppDelegate



- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {


    /* 打开调试日志 */

    [[UMSocialManagerdefaultManager]openLog:YES];

    

    /* 设置友盟appkey */

    [[UMSocialManagerdefaultManager]setUmSocialAppkey:@"58256783a325115d9a0000c2"];

    

    [selfconfigUSharePlatforms];

    

    // 获取友盟social版本号

    NSLog(@"UMeng social version: %@", [UMSocialGlobalumSocialSDKVersion]); 

    

    returnYES;

}


//各个平台的appkeyappsecret

- (void)configUSharePlatforms

{

//    /* 设置微信的appKeyappSecret */

//    [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_WechatSession appKey:@"wxdc1e388c3822c80b" appSecret:@"3baf1193c85774b3fd9d18447d76cab0" redirectURL:@"http://mobile.umeng.com/social"];

    /*

     * 移除相应平台的分享,如微信收藏

     */

    //[[UMSocialManager defaultManager] removePlatformProviderWithPlatformTypes:@[@(UMSocialPlatformType_WechatFavorite)]];

    

    /* 设置分享到QQ互联的appID

     * U-Share SDK为了兼容大部分平台命名,统一用appKeyappSecret进行参数设置,而QQ平台仅需将appID作为U-ShareappKey参数传进即可。

     */

//    [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_QQ appKey:@"1105821097"/*设置QQ平台的appID*/  appSecret:nil redirectURL:@"http://mobile.umeng.com/social"];

    

    /* 设置新浪的appKeyappSecret */   //redirectURL-分享结束后跳回到哪个地址

    [[UMSocialManagerdefaultManager]setPlaform:UMSocialPlatformType_SinaappKey:@"3348473715" appSecret:@"1cc5d0ce859ec7c4da41754e6488f611"redirectURL:@"https://www.baidu.com"];


要在 target ----》info-----》url type设置相应平台的标识。z注意:qq要添加两个urlscheme;

需要添加两项URL Scheme:
1、"tencent"+腾讯QQ互联应用appID
2、“QQ”+腾讯QQ互联应用appID转换成十六进制(不足8位前面补0)
如appID:100424468 1、tencent100424468 
2、QQ05fc5b14
QQ05fc5b14为100424468转十六进制而来,因不足8位向前补0,然后加"QQ"前缀

}








//设置系统回调----授权或分享之后就会执行下面的方法

//回调。iOS10.0以上使用

// 当用户通过其它应用启动本应用时,会回调这个方法,url参数是其它应用调用openURL:方法时传过来的。

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options

{

    NSLog(@"option------%@",options);

    //options------{

    //    UIApplicationOpenURLOptionsOpenInPlaceKey = 0;

    //    UIApplicationOpenURLOptionsSourceApplicationKey = "com.sina.weibo";

    //}

    NSLog(@"url---%@",url);//url---wb3348473715://response?id=EB0C8865-D57C-4625-8C78-5C155F137F3D&sdkversion=2.5

    /**

     *  获得从sso(获得第三方账号授权单点登录)或者web端回调到本app的回调

     *

     *  @param url 第三方sdk的打开本app的回调的url

     *

     *  @return 是否处理  YES代表处理成功,NO代表不处理

     *   如果不执行下面这个回调函数,就获取不到第三方用户信息,也或去不到分享之后回调中的信息

     */


    BOOL result=[[UMSocialManagerdefaultManager]handleOpenURL:url];

    

//    BOOL result= [[UMSocialManager defaultManager] handleOpenURL:url options:options];//这是另一个方法

    

//    NSLog(@"result--%d",result);

//    if (!result) {

//        // 其他如支付等SDK的回调

//    }


    return result;

}


//*********************

//ios9以后就不用了

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

//{

//    NSLog(@"调用了");

//    BOOL result = [[UMSocialManager defaultManager] handleOpenURL:url];

//    if (!result) {

//        NSLog(@"***************");

//    }

//    return result;

//}


支持所有iOS系统//ios9以后就不用了

//

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

//{

    NSLog(@"新浪的回掉");

    //6.3的新的API调用,是为了兼容国外平台(例如:新版facebookSDK,VK)的调用[如果用6.2api调用会没有回调],对国内平台没有影响

//    BOOL result = [[UMSocialManager defaultManager] handleOpenURL:url ];

    if (!result) {

        // 其他如支付等SDK的回调

    }

//    return result;

//}

//***************************************


@end

//*****************************

#import "ViewController.h"

#import <UMSocialCore/UMSocialCore.h>

#import <UShareUI/UShareUI.h>

#import "AutoDefineShared.h"

@interface ViewController ()<UMSocialHandlePlatformTypeDelegate>


@end


@implementation ViewController


-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{

    

   

    [selfshare];

}


//弹出分享

-(void)share{


    NSLog(@"点击了");

        //***********************

    //***********************用法类似

    //    分享目前支持的类型有:

    //

    //     网页类型(网页链接)

    //

    //     图片

    //

    //     文本

    //

    //     表情(GIF图片,即Emotion类型,只有微信支持)

    //

    //     图文(包含一张图片和一段文本)

    //

    //     视频(只支持视频URL、缩略图及描述)

    //

    //     音乐(只支持音乐URL、缩略图及描述)

    //**********************************


        //******************

        //    [self  shareWebPageToPlatformTypeLink:UMSocialPlatformType_Sina];//分享图片到新浪微博

        //****************

        //    [self shareWebPageToPlatformTypeLink:UMSocialPlatformType_Sina];//分享链接到新浪微博

        //    //设置预定义平台------只有配置过appkeyappscript的平台会有效(如果不设置预定义平台,默认显示出来的分享面板上只有新浪微博,腾讯qqqq空间)

        //    NSArray *platforms=@[@(UMSocialPlatformType_Sina),@(UMSocialPlatformType_WechatSession),@(UMSocialPlatformType_WechatTimeLine),@(UMSocialPlatformType_WechatFavorite)];

        //        [UMSocialUIManager setPreDefinePlatforms:platforms];

    

        //    //自定义分享面板

        //    [self  defineMyselfMenue];

        //

    //    //弹出分享面板

//        [self shareWebPageToPlatformType];

    

        //**************************根据uid请求用户名和密码,然后到自己的后台注册账号

            [selfgetAuthWithUserInfoFromSina];//获取新浪平台授权并且获取用户信息后,到自己的后台注册账号


}



//获取用户信息,然后根据获取到的信息,调用自己的后台提供的注册接口构建自己的app账号,例如:头像,usename(做用户名),uid(作密码)

-(void)getAuthWithUserInfoFromSina{

    //step2 获得用户信息(获得用户信息中包含检查授权的信息了)

    [[UMSocialManagerdefaultManager]getUserInfoWithPlatform:UMSocialPlatformType_SinacurrentViewController:nilcompletion:^(id result,NSError *error) {

        NSLog(@"授权和获取用户信息");

        NSString *message =nil;

        

        if (error) {

           //如果用户点击了取消授权或返回,会提示错误

            message = @"Get user info fail";

            UMSocialLogInfo(@"Get user info fail with error %@",error);

            NSLog(@"error----%@",error);

        }else{

            if ([resultisKindOfClass:[UMSocialUserInfoResponseclass]]) {

                UMSocialUserInfoResponse *resp = result;

                // 授权信息

                UMSocialLogInfo(@"UserInfoAuthResponse uid: %@", resp.uid);

                UMSocialLogInfo(@"UserInfoAuthResponse accessToken: %@", resp.accessToken);

                UMSocialLogInfo(@"UserInfoAuthResponse refreshToken: %@", resp.refreshToken);

                UMSocialLogInfo(@"UserInfoAuthResponse expiration: %@", resp.expiration);

                

                // 用户信息

                UMSocialLogInfo(@"UserInfoResponse name: %@", resp.name);

                UMSocialLogInfo(@"UserInfoResponse iconurl: %@", resp.iconurl);

                UMSocialLogInfo(@"UserInfoResponse gender: %@", resp.gender);

                

                // 第三方平台SDK源数据,具体内容视平台而定

                UMSocialLogInfo(@"OriginalUserProfileResponse: %@", resp.originalResponse);

                

                message = [NSStringstringWithFormat:@"name: %@\n icon: %@\n gender: %@\n",resp.name,resp.iconurl,resp.gender];

            }else{

                message = @"Get user info fail";

                UMSocialLogInfo(@"Get user info fail with  unknow error");

            }

        }

        UIAlertView *alert = [[UIAlertViewalloc]initWithTitle:@"UserInfo"

                                                        message:message

                                                       delegate:nil

                                              cancelButtonTitle:NSLocalizedString(@"sure",@"确定")

                                              otherButtonTitles:nil];

        [alert show];

        

        

    }];

    

    

    //    //如果需要获得用户信息直接跳转的话,需要先取消授权

    //    //    //step1 取消授权

    //    [[UMSocialManager defaultManager] cancelAuthWithPlatform:UMSocialPlatformType_Sina completion:^(id result, NSError *error) {

    //        NSLog(@"取消授权 ");

    //    }];



}

- (void)viewDidLoad {

    [superviewDidLoad];

    self.view.backgroundColor=[UIColorredColor];

}


分享网页链接

//- (void)shareWebPageToPlatformTypeLink:(UMSocialPlatformType)platformType

//{

//    //创建分享消息对象

//    UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];

//    //分享的文本内容

//    messageObject.text=@"百度不错哟";

//    //创建网页内容对象

//    UIImage *thumbURL=[UIImage imageNamed:@"上海滩1"];

        NSString* thumbURL =  @"http://pic6.huitu.com/res/20130116/84481_20130116142820494200_1.jpg";//缩略图

//    UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:@"跳转到百度" descr:@"欢迎使用百度!" thumImage:thumbURL];

//    //分享的网页地址

//    shareObject.webpageUrl = @"http://baidu.com";

//

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

//    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仅仅支持图片或文本,新浪微博同时支持图片和文本)

- (void)shareWebPageToPlatformTypeImage:(UMSocialPlatformType)platformType

{

    

    //创建分享消息对象

    UMSocialMessageObject *messageObject = [UMSocialMessageObjectmessageObject];

    //分享的文本内容

    messageObject.text=@"百度不错哟";

    //创建网页内容对象

    UIImage *thumbURL=[UIImageimageNamed:@"上海滩1"];

    

    UMShareImageObject *imageshareobj=[UMShareImageObjectshareObjectWithTitle:@"分享图片"descr:@"图片"thumImage:thumbURL];

    imageshareobj.shareImage=thumbURL;//分享的图片

    

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

    messageObject.shareObject = imageshareobj;

    

    //调用分享接口

    [[UMSocialManagerdefaultManager]shareToPlatform:platformTypemessageObject:messageObjectcurrentViewController:selfcompletion:^(id data,NSError *error) {

        if (error) {

            UMSocialLogInfo(@"************Share fail with error %@*********",error);

        }else{

            if ([dataisKindOfClass:[UMSocialShareResponseclass]]) {

                UMSocialShareResponse *resp = data;

                //分享结果消息

                UMSocialLogInfo(@"response message is %@",resp.message);

                //第三方原始返回的数据

                UMSocialLogInfo(@"response originalResponse data is %@",resp.originalResponse);

                

            }else{

                UMSocialLogInfo(@"response data is %@",data);

            }

        }

    }];

    

}


分享音乐

//- (void)shareMusicToPlatformTypeMusic:(UMSocialPlatformType)platformType

//{

//    //创建分享消息对象

//    UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];

//

//    //创建音乐内容对象

//    UMShareMusicObject *shareObject = [UMShareMusicObject shareObjectWithTitle:@"分享标题" descr:@"分享内容描述" thumImage:[UIImage imageNamed:@"icon"]];

//    //设置音乐网页播放地址

//    shareObject.musicUrl = @"http://c.y.qq.com/v8/playsong.html?songid=108782194&source=yqq#wechat_redirect";

//    //            shareObject.musicDataUrl = @"这里设置音乐数据流地址(如果有的话,而且也要看所分享的平台支不支持)";

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

//    messageObject.shareObject = shareObject;

//

//    //调用分享接口

//    [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {

//        if (error) {

//            NSLog(@"************Share fail with error %@*********",error);

//        }else{

//            NSLog(@"response data is %@",data);

//        }

//    }];

//}


分享视频

//- (void)shareVedioToPlatformType:(UMSocialPlatformType)platformType

//{

//    //创建分享消息对象

//    UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];

//

//    //创建视频内容对象

//    UMShareVideoObject *shareObject = [UMShareVideoObject shareObjectWithTitle:@"分享标题" descr:@"分享内容描述" thumImage:[UIImage imageNamed:@"icon"]];

//    //设置视频网页播放地址

//    shareObject.videoUrl = @"http://video.sina.com.cn/p/sports/cba/v/2013-10-22/144463050817.html";

//    //            shareObject.videoStreamUrl = @"这里设置视频数据流地址(如果有的话,而且也要看所分享的平台支不支持)";

//

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

//    messageObject.shareObject = shareObject;

//

//    //调用分享接口

//    [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {

//        if (error) {

//            NSLog(@"************Share fail with error %@*********",error);

//        }else{

//            NSLog(@"response data is %@",data);

//        }

//    }];

//}



//调用分享面板

- (void)shareWebPageToPlatformType{

    //导入速度快时有几个模块,这里会显示几个模块;如果想显示,在APPdelegate中取消相应模块

    //显示分享面板

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

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

        NSLog(@"platform0----%tu------%@",platformType,userInfo);

        __weaktypeof(self) weakSelf=self;

        if(platformType ==UMSocialPlatformType_Sina){

            [weakSelf shareWebPageToPlatformTypeImage:UMSocialPlatformType_Sina];//分享到新浪微博

            

        }

        

    }];

}


//自定义分享面板UI

-(void)defineMyselfMenue{

    //*****************分享面板的配置

    //  UMSocialSharePageGroupViewConfig*          sharePageGroupViewConfig;

    

    //    [UMSocialShareUIConfig shareInstance].sharePageGroupViewConfig.sharePageGroupViewBackgroundColor=[UIColor brownColor];//背景颜色

    //        [UMSocialShareUIConfig shareInstance].sharePageGroupViewConfig.sharePageGroupViewMaskColor=[UIColor purpleColor];//分享菜单整个背景

    //        [UMSocialShareUIConfig shareInstance].sharePageGroupViewConfig.sharePageGroupViewMaskViewAlpha=0.5;//分享菜单整个背景的Alpha

    //        [UMSocialShareUIConfig shareInstance].sharePageGroupViewConfig.sharePageGroupViewPostionType=UMSocialSharePageGroupViewPositionType_Middle;//分享面板类的位置@see UMSocialSharePageGroupViewPositionType

    

    

    //********************分享面板中分享平台的配置

    //    UMSocialShareContainerConfig* shareContainerConfig;

    //    [UMSocialShareUIConfig shareInstance].shareContainerConfig.shareContainerMarginTop=10.0;//相对父view的上边距

    //        [UMSocialShareUIConfig shareInstance].shareContainerConfig.shareContainerMarginBottom=10.0;//相对父view的下边距

    //        [UMSocialShareUIConfig shareInstance].shareContainerConfig.shareContainerMarginLeft=30.0;//相对父view的左边距

    //        [UMSocialShareUIConfig shareInstance].shareContainerConfig.shareContainerMarginRight=30.0;//相对父view的右边距

    //        [UMSocialShareUIConfig shareInstance].shareContainerConfig.shareContainerMarginLeftForMid;//相对父view的左边距如果sharePageGroupViewPostionTypeUMSocialSharePageGroupViewPositionType_Middle的时候

    //    [UMSocialShareUIConfig shareInstance].shareContainerConfig.shareContainerMarginRightForMid;//相对父view的右边距相对父view的左边距如果sharePageGroupViewPostionTypeUMSocialSharePageGroupViewPositionType_Middle的时候

    //    [UMSocialShareUIConfig shareInstance].shareContainerConfig.shareContainerCornerRadius=15.0;//圆角

    //    [UMSocialShareUIConfig shareInstance].shareContainerConfig.shareContainerBackgroundColor=[UIColor blackColor];//背景色

    //    [UMSocialShareUIConfig shareInstance].shareContainerConfig.isShareContainerHaveGradient=YES;//是否开启渐变当滑动到边缘的时候

    //    [UMSocialShareUIConfig shareInstance].shareContainerConfig.shareContainerGradientStartColor=[UIColor redColor];//渐变开始的颜色

    //    [UMSocialShareUIConfig shareInstance].shareContainerConfig.shareContainerGradientEndColor=[UIColor blueColor];//渐变结束的颜色

    //    [UMSocialShareUIConfig shareInstance].shareContainerConfig.shareContainerGradientLeftWidth=25.0;//左边的渐变宽度

    //    [UMSocialShareUIConfig shareInstance].shareContainerConfig.shareContainerGradientRightWidth=15.0;//右边的渐变宽度

    

    

    // //********************分享面板标题的设置

        UMSocialShareTitleViewConfig*    shareTitleViewConfig;

    //    [UMSocialShareUIConfig shareInstance].shareTitleViewConfig.isShow=YES;//是否显示

    //        [UMSocialShareUIConfig shareInstance].shareTitleViewConfig.shareTitleViewTitleString=@"分享平台如下";//标题的文字

    //        [UMSocialShareUIConfig shareInstance].shareTitleViewConfig.shareTitleViewFont=[UIFont systemFontOfSize:20];//字体

    //        [UMSocialShareUIConfig shareInstance].shareTitleViewConfig. shareTitleViewTitleColor=[UIColor greenColor];//文字颜色

    //        [UMSocialShareUIConfig shareInstance].shareTitleViewConfig.shareTitleViewBackgroundColor=[UIColor yellowColor];//背景颜色

    //        [UMSocialShareUIConfig shareInstance].shareTitleViewConfig.shareTitleViewPaddingTop=1.0;//title的内边距top

    //            [UMSocialShareUIConfig shareInstance].shareTitleViewConfig.shareTitleViewPaddingBottom=1.0;//title的内边距Bottom

    

    

    //*******************  ShareScrollView的配置类

        UMSocialSharePageScrollViewConfig*         sharePageScrollViewConfig;

    //        [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewBackgroundColor=[UIColor brownColor];//shareScrollView背景色

    //        [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageRowSpace=5.0;//每页的行间距

    //        [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageColumnSpace=5.0;//每页的列间距(在设置了shareScrollViewPageMaxItemWidth后,列间距会变化一般设置只是估算每行的容纳的item的个数)

    //

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageMarginLeft=5.0; //每页的左边距

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageMarginRight=5.0; //每页的右边距

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageMarginTop=5.0; //每页的上边距

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageMarginBottom=5.0; //每页的下边距

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPadingLeft=10.0; //ScrollViewLeft外边距(相对与父窗口)

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPadingRight=10.0; //ScrollViewRight外边距(相对与父窗口)

    //

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPadingTop=3; //ScrollViewTop边距(相对与父窗口)

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPadingBottom=3; //ScrollViewBottom边距(相对与父窗口)

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageMaxItemWidth=50; //每页Items的最大宽度

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageMaxItemHeight=50; //每页Items的最大高度

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageMaxItemBGWidth=50; //每页Item内部icon下背景的宽度与shareScrollViewPageMaxItemWidth相同

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageMaxItemBGHeight=50; //每页Item内部icon下背景的高度与shareScrollViewPageMaxItemBGWidth相同

    //

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageMaxItemIconWidth=10; //每页Item内部icon下宽度

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageMaxItemIconHeight=10; //每页Item内部icon下高度

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageMaxItemSpaceBetweenIconAndName=10; //每页Item背景和icon的上下间距

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageMaxItemNameHeight=10; //每页Itemname的高度

    //

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageMaxItemNameWidth=30; //每页Itemname的宽度,和shareScrollViewPageMaxItemBGWidth一样

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageBGColor=[UIColor yellowColor]; //每页的背景颜色

//    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageItemStyleType=UMSocialPlatformItemViewBackgroudType_IconAndBGRadius;//@see UMSocialPlatformItemViewBackgroudType//默认没有圆背景

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageMaxRowCountForPortraitAndBottom=2; //每页显示最大的行(在底部显示手机处于肖像模式)

    //

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageMaxColumnCountForPortraitAndBottom=5; //每页显示最大的列(在底部显示手机处于肖像模式)

    //

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageMaxRowCountForLandscapeAndBottom=2; //每页显示最大的行(在底部显示手机处于风景模式)

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageMaxColumnCountForLandscapeAndBottom=5; //每页显示最大的列(在底部显示手机处于风景模式)

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageMaxRowCountForPortraitAndMid=2; //每页显示最大的行(在中间显示手机处于肖像模式)

    //

    //

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageMaxColumnCountForPortraitAndMid=5; //每页显示最大的列(在中间显示手机处于肖像模式)

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageMaxRowCountForLandscapeAndMid=2; //每页显示最大的行(在中间显示手机处于风景模式)

    //    [UMSocialShareUIConfig shareInstance].sharePageScrollViewConfig.shareScrollViewPageMaxColumnCountForLandscapeAndMid=5; //每页显示最大的列(在中间显示手机处于风景模式)

    

    

    //*******************  每个pageItem的配置类

    

        UMSocialPlatformItemViewConfig*            sharePlatformItemViewConfig;

    //

    //    [UMSocialShareUIConfig shareInstance].sharePlatformItemViewConfig.sharePlatformItemViewBGRadiusColor=[UIColor yellowColor]; //有圆角背景时的颜色

    //    [UMSocialShareUIConfig shareInstance].sharePlatformItemViewConfig.sharePlatformItemViewBGRadiusColorPressed=[UIColor blueColor];//有圆角背景时的按下颜色

    //

    //    [UMSocialShareUIConfig shareInstance].sharePlatformItemViewConfig.sharePlatformItemViewPlatformNameColor=[UIColor brownColor];//平台的颜色(平台名称的文字颜色)

    

    

    //*******************  SharePageControl的配置类

    

    //    UMSocialSharePageControlConfig*            sharePageControlConfig;

//    [UMSocialShareUIConfig shareInstance].sharePageControlConfig.isShow=YES;//是否显示

//    [UMSocialShareUIConfig shareInstance].sharePageControlConfig.sharePageControlPageIndicatorTintColor=[UIColor redColor];//指示器颜色

//    [UMSocialShareUIConfig shareInstance].sharePageControlConfig.sharePageControlCurrentPageIndicatorTintColor=[UIColor greenColor];//当前的页的颜色

//    [UMSocialShareUIConfig shareInstance].sharePageControlConfig.sharePageControlHidesForSinglePage=NO;//为一页是会隐藏

//    [UMSocialShareUIConfig shareInstance].sharePageControlConfig.sharePageControlBackgroundColor=[UIColor purpleColor];//背景色

    

    

    //*********************取消按钮的设置

    //    UMSocialShareCancelControlConfig*          shareCancelControlConfig;

//    [UMSocialShareUIConfig shareInstance].shareCancelControlConfig. isShow=YES;//是否显示取消按钮

//    [UMSocialShareUIConfig shareInstance].shareCancelControlConfig.shareCancelControlText=@"取消按钮";//取消按钮的文字

//    [UMSocialShareUIConfig shareInstance].shareCancelControlConfig.shareCancelControlTextColor=[UIColor redColor];//文字颜色

//    [UMSocialShareUIConfig shareInstance].shareCancelControlConfig.shareCancelControlTextFont=[UIFont systemFontOfSize:15];//文字字体

//    [UMSocialShareUIConfig shareInstance].shareCancelControlConfig.shareCancelControlBackgroundColor=[UIColor yellowColor];//背景颜色

//    [UMSocialShareUIConfig shareInstance].shareCancelControlConfig.shareCancelControlBackgroundColorPressed=[UIColor blueColor];//点击时的按下颜色

//    

//    

    //**********************

    

    

}


//在分享面板自定义自己的平台的icon

-(void)myselfDefineIcon{


        //****************在分享面板定制自己的icon的操作

        //加入copy的操作

        //@see http://dev.umeng.com/social/ios/进阶文档#6

    

        [UMSocialUIManageraddCustomPlatformWithoutFilted:UMSocialPlatformType_UserDefine_Begin+2

                                         withPlatformIcon:[UIImageimageNamed:@"上海滩1"]

                                         withPlatformName:@"copy"];

    

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

            //在回调里面获得点击的

            if (platformType ==UMSocialPlatformType_UserDefine_Begin+2) {

                NSLog(@"do your operation for copy");

            }

            else{

            }

        }];



}


//自定义分享平台

-(void)myselfDefinePlatform{


}




@end


//***************************************************************

//注意事项:有关http和https的注意事项:http://blog.csdn.net/iosbird/article/details/50420547


//友盟分享--第三方登录----http://blog.csdn.net/u011146511/article/details/62045478

//第三方登录-----http://blog.csdn.net/u011146511/article/details/55506433

//#import "LYShareVC.h"

//#import <UMSocialCore/UMSocialCore.h>

//#import <UShareUI/UShareUI.h>

//#import "Header.h"


//#import "WXApi.h"//判断安装微信

//#import <TencentOpenAPI/QQApiInterface.h> //判断=安装QQ



//@interface LYShareVC ()

//@property(nonatomic,strong)UIButton *leftBtn;

//@property(nonatomic,strong)UIButton *rightBtn;

//@property(nonatomic,strong)UILabel *contentlbl;

//@property(nonatomic,strong)UIImage *sharedImage;

//@property(nonatomic,copy)NSString *haveInvideTotalNum;//已经邀请多少人

//@property (weak, nonatomic) IBOutlet UIView *invideFriendView;

//@property (weak, nonatomic) IBOutlet UIImageView *ewmImageV;

//

//@property (weak, nonatomic) IBOutlet UILabel *invidecodephoneLabel;//邀请码

//@property (weak, nonatomic) IBOutlet UILabel *invidefriendlabel;//已邀请多少人

//

//

//@property (weak, nonatomic) IBOutlet UIButton *invideBtn;

//

//

//@end

//

//@implementation LYShareVC

//target -->info--->UType设置


//1.*************在appdelegate中实现

//#import "UMSocialWechatHandler.h"

//

//#import <UMMobClick/MobClick.h>

//

//#import <UMSocialCore/UMSocialCore.h>

//各个平台的appkey和appsecret

//- (void)configUSharePlatforms

//{

//    /*

//

//     //预定义的平台

//     UMSocialPlatformType_Predefine_Begin    = -1,

//     UMSocialPlatformType_Sina               = 0, //新浪

//     UMSocialPlatformType_WechatSession      = 1, //微信聊天

//     UMSocialPlatformType_WechatTimeLine     = 2,//微信朋友圈

//     UMSocialPlatformType_WechatFavorite     = 3,//微信收藏

//     UMSocialPlatformType_QQ                 = 4,//QQ聊天页面

//     UMSocialPlatformType_Qzone              = 5,//qq空间

//     UMSocialPlatformType_TencentWb          = 6,//腾讯微博

//     UMSocialPlatformType_AlipaySession      = 7,//支付宝聊天页面

//     UMSocialPlatformType_Sms                = 13,//短信

//     UMSocialPlatformType_Email              = 14,//邮件

//     */

//

//

//

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

//    [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_WechatSession appKey:@"wx1f5becbc40619f14" appSecret:@"06e2f7b36238cb23d7edd1d9cdf6093c" redirectURL:@"http://mobile.umeng.com/social"];

//    /*

//     * 移除相应平台的分享,如微信收藏

//     */

//    [[UMSocialManager defaultManager] removePlatformProviderWithPlatformTypes:@[@(0),@(UMSocialPlatformType_AlipaySession)]];//

//    [[UMSocialManager defaultManager]removePlatformProviderWithPlatformType:UMSocialPlatformType_Sina];

//

//

//    /* 设置分享到QQ互联的appID

//     * U-Share SDK为了兼容大部分平台命名,统一用appKey和appSecret进行参数设置,而QQ平台仅需将appID作为U-Share的appKey参数传进即可。

//     */

//    [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_QQ appKey:@"1106152761"  appSecret:@"VbDO9VLgmBV2Bmyi" redirectURL:@"http://www.ahwofu.com"];

//

//    //    /* 设置新浪的appKey和appSecret */   //redirectURL-分享结束后跳回到哪个地址

//    [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_Sina appKey:@"3348473715"  appSecret:@"1cc5d0ce859ec7c4da41754e6488f611" redirectURL:@"http://www.ahwofu.com"];

//

//}


===================友盟配置================

///* 打开调试日志 */

//[[UMSocialManager defaultManager] openLog:YES];

//

///* 设置友盟appkey */

//[[UMSocialManager defaultManager] setUmSocialAppkey:@"58256783a325115d9a0000c2"];//2号钱包59f024588f4a9d78c10001fa---58256783a325115d9a0000c2---com.ahwofu.walleter

//

//[self configUSharePlatforms];

//

获取友盟social版本号

//NSLog(@"UMeng social version: %@", [UMSocialGlobal umSocialSDKVersion]);

//

===================友盟配置===============



//2。****************.在控制器中实现

//***************分享网页链接****************

//#import "LYShareVideoVC.h"

//#import <UMSocialCore/UMSocialCore.h>

//#import <UShareUI/UShareUI.h>

//#import "WXApi.h"//判断安装微信

//#import <TencentOpenAPI/QQApiInterface.h> //判断=安装QQ

//@interface LYShareVideoVC ()<UIWebViewDelegate>

//

//@end

//

//@implementation LYShareVideoVC

//

//- (void)viewDidLoad {

//    [super viewDidLoad];

//    self.navigationItem.title=@"分享视频";

//    self.navigationItem.rightBarButtonItems=[UIBarButtonItem addrightBtn:@selector(addrightBtn:) target:self image:nil title:@"分享"];

//    [self setWeb];

//}

//-(void)addrightBtn:(UIButton *)btn{

//    btn.enabled=NO;

//    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

//        btn.enabled=YES;

//    });

//    if([LYCommanManager sharedManager].isreachable){

//        if([SPMobileApplication sharedInstance].isLogined){

//            [self shareWebPageToPlatformType];

//        }else{

//            [[LYCommonMBprogresshud sharedManager]showProgresshudTextWith:self.view title:@"请登录" detailtitle:@"" isOnDismissbg:NO hideAfterdelay:YES];

//        }

//    }else{

//        [[LYCommonMBprogresshud sharedManager]showProgresshudTextWith:self.view title:@"请检查网络" detailtitle:@"" isOnDismissbg:NO hideAfterdelay:YES];

//    }

//}

调用分享面板

//- (void)shareWebPageToPlatformType{

//

//    //显示分享面板

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

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

//        NSLog(@"platform0----%tu------%@",platformType,userInfo);

//        __weak typeof(self) weakSelf=self;

//        if(platformType ==UMSocialPlatformType_WechatSession){

//            if (![WXApi isWXAppInstalled]) {

//                [self tipInstallWithString:@"未安装微信"];

//            }else{

//                [weakSelf shareWebPageToPlatformTypeLink:UMSocialPlatformType_WechatSession];//分享到微信--选择后分享

//            }

//        }

//        else if(platformType ==UMSocialPlatformType_QQ){

//            if (![QQApiInterface isQQInstalled]){ [self tipInstallWithString:@"未安装QQ"];}else {

//

//                [weakSelf shareWebPageToPlatformTypeLink:UMSocialPlatformType_QQ];//分享到QQ

//            }

//        }else if(platformType ==UMSocialPlatformType_Qzone){

//            if (![QQApiInterface isQQInstalled]){ [self tipInstallWithString:@"未安装QQ"];}else {

//                [weakSelf shareWebPageToPlatformTypeLink:UMSocialPlatformType_Qzone];//分享到QQ空间

//            }

//        }else if(platformType ==UMSocialPlatformType_WechatTimeLine){

//            if (![WXApi isWXAppInstalled]) { [self tipInstallWithString:@"未安装微信"];}else{

//                [weakSelf shareWebPageToPlatformTypeLink:UMSocialPlatformType_WechatTimeLine];//分享到微信朋友圈

//            }

//        }else if(platformType ==UMSocialPlatformType_WechatFavorite){

//            if (![WXApi isWXAppInstalled]) { [self tipInstallWithString:@"未安装微信"];}else{

//                [weakSelf shareWebPageToPlatformTypeLink:UMSocialPlatformType_WechatFavorite];//分享到微信收藏

//            }

//        }else if(platformType ==UMSocialPlatformType_Sms){

//            [weakSelf shareWebPageToPlatformTypeLink:UMSocialPlatformType_Sms];//分享到短信

//        }else if(platformType ==UMSocialPlatformType_Sina){

//            //            if (![[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"xlwb://wb3348473715"]]){NSLog(@"未安装微博"); [self tipInstallWithString:@"未安装微信"];}else {

//            [weakSelf shareWebPageToPlatformTypeLink:UMSocialPlatformType_Sina];//分享到新浪微博

//            //            }

//        }

//

//    }];

//}

//

分享网页链接

//- (void)shareWebPageToPlatformTypeLink:(UMSocialPlatformType)platformType

//{

//    //创建分享消息对象

//    UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];

//    //分享的文本内容

//    messageObject.text=@"2号钱包";

//

//    //创建网页内容对象

//    UIImage *thumbURL=[UIImage imageNamed:@"appstart"];//缩略图

//    //    UIImage *thumbURL=self.sharedImage;

//    NSString *title=@"2号钱包操作视频教程!";

//    NSString *detailtitle=@"2号钱包是一款会赚钱的掌上POS机,可以刷自己信用卡的APP";

//    UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:title descr:detailtitle thumImage:thumbURL];

//

//    //分享的网页地址

//    NSString *urlStr=@"http://www.ddb.cn/public/apk/spjc.mp4";

//

//    shareObject.webpageUrl =urlStr;

//

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

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

//            }

//        }

//    }];

//}

//

//

//

//-(void)tipInstallWithString:(NSString *)platnameStr{

//

//    UIAlertController *controller=[UIAlertController alertControllerWithTitle:platnameStr message:@"" preferredStyle:UIAlertControllerStyleAlert];

//    UIAlertAction *sure=[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {

//

//    }];

//    [controller addAction:sure];

//    [self presentViewController:controller animated:YES completion:nil];

//}



生成二维码

//-(void)createErweimaWithpaytype:(NSString *)jsonStr{

//

//    // 1.创建滤镜

//    CIFilter *filter = [CIFilter filterWithName:@"CIQRCodeGenerator"];

//

//    // 2.还原滤镜默认属性

//    [filter setDefaults];

//

//

//    //    NSString *url=[NSString stringWithFormat:@"http://test.ahwofu.com/api/fukuan/anyIndex?pay=%@",jsonStr];

//

//    // 3.设置需要生成二维码的数据到滤镜中

//    // OC中要求设置的是一个二进制数据

//

//    NSData *data = [jsonStr dataUsingEncoding:NSUTF8StringEncoding];

//    [filter setValue:data forKeyPath:@"InputMessage"];

//

//    // 4.从滤镜从取出生成好的二维码图片

//    CIImage *ciImage = [filter outputImage];

//

//    UIImage *image=[self createNonInterpolatedUIImageFormCIImage:ciImage withSize:140];

//    NSLog(@"imageframe%f",image.size.width);

//    self.sharedImage=image;

//

//    self.ewmImageV.image=image;

//}

//

//

生成高清二维码并设置大小

//- (UIImage *)createNonInterpolatedUIImageFormCIImage:(CIImage *)image withSize:(CGFloat) size {

//    CGRect extent = CGRectIntegral(image.extent);

//    CGFloat scale = MIN(size/CGRectGetWidth(extent), size/CGRectGetHeight(extent));

//    // 创建bitmap;

//    size_t width = CGRectGetWidth(extent) * scale;

//    size_t height = CGRectGetHeight(extent) * scale;

//    CGColorSpaceRef cs = CGColorSpaceCreateDeviceGray();

//    CGContextRef bitmapRef = CGBitmapContextCreate(nil, width, height, 8, 0, cs, (CGBitmapInfo)kCGImageAlphaNone);

//    CIContext *context = [CIContext contextWithOptions:nil];

//    CGImageRef bitmapImage = [context createCGImage:image fromRect:extent];

//    CGContextSetInterpolationQuality(bitmapRef, kCGInterpolationNone);

//    CGContextScaleCTM(bitmapRef, scale, scale);

//    CGContextDrawImage(bitmapRef, extent, bitmapImage);

//    // 保存bitmap到图片

//    CGImageRef scaledImage = CGBitmapContextCreateImage(bitmapRef);

//    CGContextRelease(bitmapRef);

//    CGImageRelease(bitmapImage);

//    return [UIImage imageWithCGImage:scaledImage];

//}

//



//************分享图片

分享网页链接

//- (void)shareWebPageToPlatformTypeLink:(UMSocialPlatformType)platformType

//{

//

//    UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, NO, 0);

//

//    CGContextRef ctx =  UIGraphicsGetCurrentContext();

//

//    [self.view.layer renderInContext:ctx];

//

//    // 这个是要分享图片的样式(自定义的)

//    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();

//

//    //创建分享消息对象

//    UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];

//

//

//    //创建图片内容对象

//    UMShareImageObject *shareObject = [[UMShareImageObject alloc] init];

//    //如果有缩略图,则设置缩略图

//    //shareObject.thumbImage = [UIImage imageNamed:@"appstart"];

//    //[shareObject setShareImage:@"https://mobile.umeng.com/images/pic/home/social/img-1.png"];

//    shareObject.thumbImage = newImage;

//    [shareObject setShareImage:newImage];

//

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

//    messageObject.shareObject = shareObject;

//

//

//

//    //调用分享接口

//    [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {

//        if (error) {

//            NSLog(@"************Share fail with error %@*********",error);

//        }else{

//            NSLog(@"response data is %@",data);

//        }

//    }];

//}


//@end




  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值