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 ];

  • 相关阅读:
    SpringBoot打包的程序部署到服务器后一直在后台运行
    ubuntu搭建mysql数据库
    解决ubuntu16.04 ‘E: 无法获得锁 /var/lib/dpkg/lock-frontend
    项目部署篇之——下载安装Xftp6,Xshell6
    linux 文件 chgrp、chown、chmod
    linux 正确的关机方法
    linux 常用命令
    spring 事务
    Spring 中 ApplicationContext 和 BeanFactory 的区别
    java 异常处理
  • 原文地址:https://www.cnblogs.com/lidongxiao/p/4950000.html
Copyright © 2011-2022 走看看