zoukankan      html  css  js  c++  java
  • 友盟第三方登陆

    友盟第三方登陆

    #pragma mark 使用第三方登陆需要重写下面两个方法 - (void)applicationDidBecomeActive:(UIApplic ation*)application {

    //登陆需要编写 [UMSocialSnsService

    applicationDidBecomeActive];
    }
    #pragma mark 使用第三方的路需要重写两个方法

    - (BOOL)application:(UIApplication *)application

    openURL:(NSURL *)url sourceApplication:(NSString

    *)sourceApplication annotation:(id)annotation

    {
    return [UMSocialSnsService

    handleOpenURL:url wxApiDelegate:nil]; }

    #pragma mark 个人资料 点击触发方法 - (void)resumeview
    {

    if (self.isBig) { [self.bigCodeImageV

    removeFromSuperview]; self.isBig = NO;

    }else if(!self.isBig) {

    UMSocialSnsPlatform *snsPlatform = [UMSocialSnsPlatformManager

    getSocialPlatformWithName:UMShareToSina]; snsPlatform.loginClickHandler(self

    ,[UMSocialControllerService defaultControllerService],YES,^(UMSocialRe sponseEntity *response){

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

    //如果是授权到新浪微博,SSO之后如果 想获取用户昵称,头像,需要再获取一次账户细腻

    [[UMSocialDataService defaultDataService]

    requestSocialAccountWithCompletion:^(UMSoc ialResponseEntity *response) {

    //获取用户昵称

    NSString

    *str=[[[response.data objectForKey:@"accounts"]objectForKey:UMSh areToSina]objectForKey:@"username"];

    //获取图片地址

    NSString

    *url=[[[response.data objectForKey:@"accounts"]objectForKey:UMSh areToSina]objectForKey:@"icon"];

    // UMSocial AccountEntity *snsAccount =

    [[UMSocialAccountManager

    socialAccountDictionary]valueForKey:UMShar eToSina];

    // NSLog(@" %@",snsAccount);

    self.myView.nameL.text =

    str; sd_setImageWithURL:[NSURL

    [self.myView.imageV URLWithString:url]];

    NSString *docPath = [NSSearchPathForDirectoriesInDomains(9, 1,

    1)lastObject];

    NSString *filePath = stringByAppendingPathComponent:@"user.txt"

    //数组写入文件

    NSArray *array = [NSArray arrayWithObjects:str,url, nil];

    [array writeToFile:filePath atomically:YES];

    //字符串写入文件

    // [str writeToFile:filePath atomically:YES

    encoding:NSUTF8StringEncoding error:nil];

    }];

    //写入本地 });

    }

    [docPath ];

  • 相关阅读:
    Python-炫酷二维码
    Dictionary 序列化与反序列化
    获取数据库所有表名与字段名
    LinQ To Object 基本用法
    使用jq操作脚本生成元素的事件
    表单验证如何让select设置为必选
    js实现复制功能兼容ios
    微信小程序使用函数防抖解决重复点击消耗性能问题
    electronr进行签名与公证
    使用electron在mac升级签名后进行升级出现“QRLUpdaterErrorDomain”的错误
  • 原文地址:https://www.cnblogs.com/lidongxiao/p/4950000.html
Copyright © 2011-2022 走看看